|
Programming -
C/C++
|
|
Saturday, 11 July 2009 08:16 |
|
Page 1 of 2

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 |