Sullivan Market

a web based full-circle development system



My C++ Tutorials - If Else Statements

If Else Statements:
    To expand on your first real program once more, I will show you the proper syntax for an If Else Statement. This will allow the programmer to decide which event, between two or more events, to perform.

#include "stdafx.h"
#include "iostream.h"

int main(int argc, char* argv[])
{
int x;
for(x=1; x <10; x++){
if (x > 5)
{
printf("Hello World!\n");
}
else if (x < 5)
{
cout << "Hello out there!!\n";
}
}
cout << "Hello out there!!\n";
return 0;
}

Back To C++ Tutorials

©2012 SullivanMarket.com