Grader program demonstrates the use of conditional statements. - C++ Operator

C++ examples for Operator:Conditional Operator

Description

Grader program demonstrates the use of conditional statements.

Demo Code

#include <iostream> 
   /*w  w w .j  a v a 2  s . c o  m*/
int main() 
{ 
    int grade; 
    std::cout << "Enter a grade (1-100): "; 
    std::cin >> grade; 
 
    if (grade >= 70) 
           std::cout << "\nYou passed. Hooray!\n"; 
    else 
           std::cout << "\nYou failed. Sigh.\n"; 
 
    return 0; 
}

Result


Related Tutorials