CPP

365
4118 reads

February 6, 2013

Using Break


The break keyword helps terminate a loop as demonstrated in this example.

33
1644 reads

February 6, 2013

Usage of Continue keyword


This example demonstrates the usage of continue keyword.

298
4332 reads

February 5, 2013

Goto statement


This example demonstrates the use of Goto Label (though it is not considered a good coding practice to use goto).

396
2907 reads

February 5, 2013

Day of the week selector


This example demonstrates the use of switch-case statement.

27
1633 reads

February 5, 2013

Positive/Negative number


This example demonstrates the use of if-elseif-else construct.

63
1637 reads

February 5, 2013

Do-While loop


This example demonstrates a do-while loop.
A DO-WHILE loop is similar to a while loop, except that a DO-WHILE loop is guaranteed to execute at least one time.

229
3766 reads

February 5, 2013

While-Loop


This example demonstrates a while loop.
A while loop statement repeatedly executes a target statement/block of statements as long as the given condition is true.

21
1811 reads

February 5, 2013

For-Loop


This example demonstrates the For loop.

The initialization step:
It is executed first, and only once. This step allows you to declare and initialize any loop control variables.

97
1616 reads

February 4, 2013

Greater Strings


This example demonstrates string comparison.
strcmp(string1, string2);
Compares string1 and string2 and returns one of the following integers (useful for alphabetical order):

127
1739 reads

February 4, 2013

Perfect Number


This program will find whether a given number is perfect or not. A perfect number is that in which we get the same result if we multiply the digits of the number or we add the digits of the number.