// Justin C. Miller
// University of Wisconsin Oshkosh
// Made for: http://www.geocities.com/neonprimetime.geo/index.html
// Date: 2001
// Borland Builder 4.0
// if else
#include
int main()
{
int grade = 77 ;
// in an if statement, if the condition
// inside the () is true, it does the first
// block of code, if it is false, it does
// the else part of the code
if(grade > 60)
{
cout << "You passed!" << endl ;
cout << "Good job!" << endl ;
}
else
{
cout << "You failed!" << endl;
cout << "Next Time Study!" << endl ;
}
// you can combine many if-else statements
// into something like this below
if(grade > 90) // covers 90+
cout << "You got an A" << endl ;
else if(grade > 80) // covers 81-90
cout << "You got a B" << endl ;
else if(grade > 70) // covers 71-80
cout << "You got a C" << endl ;
else if(grade > 60) // covers 61-70
cout << "You got a D" << endl ;
else // covers 60 and below
cout << "You got an F" << endl ;
return 0 ;
}
// Output is
// You passed!
// You got a C
               (
geocities.com/neonprimetime.geo/cpp)                   (
geocities.com/neonprimetime.geo)