Easier View

Very sorry, The posts are all mixed-up . View blog archieve to start learning =D

About Me

My name is Luke Chin. Here to teach you guys how to code C++

Thursday, April 12, 2007

The if statement ( A step ahead pay attention)

// the if statement is used to choose alternative courses of actions

#include
using std::cout; //this states that your using it so theres nomore (std::cout) just (cout)
using std::cin; // same as above but for cin

int main()
{
int grade;
cout << " Enter a grade ";
cin >> grade;

if (grade>=90)
cout << "The grade is a A";

if(grade>=80)
cout << "The grade is a B";

if(grade>=70)
cout << "The grade is a C";

system("pause");

return 0;
}


// This is a simple example of if (we will be getting more into the IF later)

-here are some things you need to know

sign meaning
> greater than
< lesser than
>= greater than or equal to
< = lesser than or equal to
== equal to
!= not equal

No comments: