 ### PCSX2 FPS Limit Fix

Fix the frame-limiting issues in PCSX2

### Complete Hanbook for Minecraft Factions

Rise to new heights on your server, by reading and following this easy guide. Let everyone fear you and respect you at the same time.

## Friday, 17 April 2015

### Begginer's Guide to C++- Chapter 5.1: Nesting in Loops

Today, we will learn nesting with loops. It is used to make some pretty spectacular programs, and I hope you will be able to make them too after reading this post!

Let us first see how the compiler executes the following statements-

for(i=0;i<5;i++)         //1
{for(j=0;j<5;j++) //2
{cout<<"@";
}
cout<<'/n';
}

The output for the above will be
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@

First, the compiler enters loop 1, the value of i in this case is 0. It then enters the second loop, which keeps on printing @ until j=5, after which loop no. 1 runs again with the value of i being 1.

This loop will again start loop no. 2, which will print @ 5 times again. This process continues till i=5.

Therefore, we conclude that each iteration will give the output as- @@@@@

Now, we will try to print
1
12
123
1234
12345

<---TRY TO SOLVE IT BEFORE READING BELOW--->

for(i=1;i<=5;i++)      // Loop1
{for(j=1;j<=i;j++)// Loop2
{cout<<j;
}
cout<<'/n';
}

What is basically happening here?
Let us go through the first through iterations.

Initially the value of i is 1, and the value of j is also 1. Also, we notice that Loop2 will run only once, as j should be less than or equal to 1.

Output: 1

Now Loop1 will run again, but this time the value of i will be 2. So j should be less than  equal to 2. So Loop2 will now run twice.

Output: 1
12

And the loop cycle goes on like this. I hope that this concept of nesting is clear to you, and you can ask any doubts related to it in the comments below, I will be happy to get back to you.

Q1. Print, using for loops-
1. 1
23
456
78910

2. A
BC
DEF
GHIJ

3. 12345
1234
123
12
1

4. 54321
4321
321
21
1

5.
1
121
12321
1234321
12321
121

1

## Tuesday, 14 April 2015

### Begginer's Guide to C++- Chapter 4.1: Digit Extraction

So here we are on yet another “Perfection Phase” Article. We will now learn to extract digits from a number. It is really simple, but since it is important, I will show you exactly how it is done.

Let the number entered by the user be stored in an integer variable named a.

Suppose that we need the sum of all the digits of the number a. Eg- if the number is 123, we want the output to be 1+2+3=6.

To implement the above, we can follow the procedure as described below:

int d, sum=0;   //d will be the extracted digit
while(a!=0)
{d=a%10;   //this expression will get the digit on the one's place.
sum=sum+d;
a=a/10;   //this expression will make the number one digit smaller
}

Let us now look at the process in much more detail, and check out what each step does.
Let the number be 123.

 Loop no. d=a%10 sum=sum+d a=a%10 1st Iteration d=3 sum=3 a=12 2nd Iteration d=2 sum=5 a=1 3rd Iteration d=1 sum=6 a=0

But some of you might think, how is the value of a equal to 12 and not 12.3 after the first iteration? The answer is that the datatype of a is int. Therefore the compiler only reads the number before the decimal, and any numbers beyond it are simply dropped. Therefore no. 12.3 will now be equal to 12.

Now that you know what digit extraction is, let us proceed to some practice questions.

Q1. Write a program to check whether the number entered by the user is a palindrome or not. (Palindromes are numbers which remain same even when they are reversed. Eg-121)

Q2. Write a program to check whether the n number entered by the user is a Armstrong number or not. (Armstrong numbers are those,  whose sum of cube of digits is equal to the number itself.)

## Sunday, 12 April 2015

### Begginer's Guide to C++- Chapter 2.1: math.h Header File

As I indicated earlier, we are now heading into the “Perfection Phase”. I will NOT be teaching anything new, but rather I will give you some deeper insight into C++. These articles will be excessively short, and will focus more on a particular concept.

This post will be telling you about the important and the most used functions of the header file “math.h”. Below, I use x to denote a variable/expression/constant.

1. ceil(x) - Returns the smallest integer not less than x. Eg- ceil(-4.8) gives output as -4, and ceil(5.9) gives output as 5.
2. floor(x) - It returns the largest integer not greater than x. Eg- floor(100.12) gives output as 100.
3. fabs(x) - It returns the absolute value/modulus of x. Eg- fabs(-45.1) gives output as 45.1, while fabs(100.12) gives output as 100.12. It necessarily converts a negative number to a positive one.
4. exp(x) - Finds the value of ex.
5. log(x)- Finds the value of logex.
6. log10(x)- Finds the value of log10x.
7. pow(x,y)- It returns the value of xy. Eg pow(2,3) will give output as 8.
8. sqrt(x)- Finds the value of x0.5. Essentially finds the value of square root of x.

This was all I could come up with after yesterday's exhaustion. It was a very busy day indeed, but the next post will be much sooner.

We recently changed our logo. Do you like it? Please comment, it really took some time to make, and I would be happy is you all take out since some to tell me how you feel about it!

## Friday, 10 April 2015

### Begginer's Guide to C++- Chapter 5: Nesting

I did not intend it to be published so fast. This one was actually on hold till Sunday, but since there was a popular demand, I posted it as soon as possible.

Nesting is really the most essential part of a C++ code. Nesting in itself is not a bit or a piece of code, but is a concept, using which one is able to make more complicated programs, which are closer to the real world model. Today, there will be no new coding and I will try to include as little code as possible. I was not thinking of posting it as a separate chapter (As I indicated in the previous chapter), but I could not think of naming it chapter 3.1 or 4.1, as nesting is an integral part of C++, and it is easy to learn as well. It is used all the way from if-else statements to for loops.

To understand nesting, just remember the following clause-

“Anything and everything can be placed inside any block”

What I mean by the above statement is that you can place an if-else statement inside a for loop, or a for loop inside a for loop. You are also allowed to place a switch case statement in a do-while loop, which inturn has a for loop in it.

There is no specific syntax for placing something inside anything (I know, its just getting confusing). Just do it as you would normally write a code.

You will be getting separate examples and practice questions for conditional statements and loops, in further chapters labeled as 5.1, 5.2 ... , till then stay tuned!

## Wednesday, 8 April 2015

### Begginer's Guide to C++- Chapter 4: Looping

Now that we have learnt to set conditions on variables, what if we want to run a particular code multiple times till a condition is true? In this article we will do just that.

Learnt in Previous Chapter:
1. if statement
2. switch statement

Some important terms:
1. Initialization: Initializes the variable which is to be put in the condition. Normal initialisation rules are followed.
2. Condition: The loop is run till the condition is true. These conditions are similar to the ones used in if-else statements.
3. Updation: For the condition to be set to false, the value of the variable in the condition need to be updated in each run of the loop. You will see this in the first example.

while loop:
A particular code inside while loop is executed again and again until a particular condition set by the programmer is valid.
Syntax-
while(Condition)
Updation; //The variable in the condition needs to be updated till the condition is false
}

Eg- I want to print numbers from 1 to 100. Obviously, I will not write a cout<< statement 100 times, this is where loops come into use.

int n=1; //Initialisation
while(n<=100) //Condition
{cout<<n<<’/t’;
n++; //Updation
}

And this will give output as-
1 2 3 …. 100
The loop will run until n is less than or equal to zero.

Q- If I write cout<<n; directly below the above example, what will the value of n be displayed as?
A- 101, as n was incremented until it was <=100, so the condition is dissatisfied when n is incremented to 101, therefore the current value of n will now be 101.

do-while loop:
This is same as a simple while loop, but now instead, this loop does not check the condition in the starting but in the end. You will understand what I am saying by reading the syntax itself.
Syntax-
do
Updation;
}while(condition);

Notice that the condition check is now in the end of the code now. This is helpful in creating menu-driven programs, where you need to run the program, until the user wishes to exit.

Eg-
1. Choice 1
2. Choice 2
3. Exit
The loop will look like-
do
{cout<<”1. Choice 1”;
cout<<”2. Choice 2”;
cout<<”3. Exit”;
cin>>choice;
switch(choice)
{//Not writing the code for switch
}
}while(choice!=3);
This will run the loop until the user enters 3 to exit the program. This is extremely efficient and will help you run programs more than 1 time.

for statement:
for loop is exactly like while loop, but the difference lies in the syntax, here all the variables and updates take place in the same place.
Syntax-
for(initialisation;condition;updation)
}

As you see, everything from initialisation to updation is in one place. You can leave field empty.
Eg-
for(int i=0;i<n;i++)
{
}
Now if you want to leave all the fields empty
int i=0;
for(;;)
{if(i<n)
{
}
i++;
}

In the above code I have show you how to skip over any arguement you want, and still have the same code.

Now, we will be practising all the concepts learnt so far till now. I will not post a tutorial, but several programmes in regular intervals, so that you get used to the concepts and also get familiar with looping, as it requires a great deal of time and practice.

I will be posting the next tutorial in approximately 14 days, but you will be getting loads of programs almost every alternate days, so that you attain perfection in the way you think and also implement the programming. I will try to teach you looping in depth, as it is one of the most integral aspects of C++, and I can’t afford anyone not knowing it. So make sure that you check the site every alternate days,for some new techniques and also some programs.

Practice Questions:
Q1. Print alternate numbers starting from 1 till the number user has entered. Report error, if the number entered by the user is even.

Q2. Print fibonacci series till the number user has entered.
0,1,1,2,3,5,8,13,21……..

Q3. Find the factorial value of the number the user has entered.

Q4. Check if the number entered by the user is prime or composite.

Q5. Check whether a number entered by the user is a perfect number or not. (Perfect numbers are those, whose sum of factors is same as the number itself. Eg- 6=1+2+3.)