Search

C++: If Statements PDF Print E-mail
User Rating: / 0
PoorBest 
Programming - C/C++
Saturday, 11 July 2009 08:16
Article Index
C++: If Statements
C++: If Statements
All Pages

Basic If Syntax

The structure of an if statement is as follows:
 
if ( TRUE )
Execute the next statement
Here is a simple example that shows the syntax:
if ( 5 < 10 )
cout<<"Five is now less than ten, that's a big surprise";
Here, we're just evaluating the statement, "is five less than ten", to see if it is true or not; with any luck, it's not! If you want, you can write your own full program including iostream and put this in the main function and run it to test.


Last Updated on Monday, 13 July 2009 23:28
 

Add comment


Security code
Refresh

We have 69 guests online