Cpp - Write program to check if a grade is passing

Requirements

Write a program that asks for a user's grade from 1 to 100.

Then asks what the passing grade is on the same scale.

Reports whether the user passed.

Demo

#include <iostream>
  
int main()//from   w  w w.j a va  2 s .  c  o m
{
    int grade;
    int passing;
    std::cout << "Enter a grade (1-100): ";
    std::cin >> grade;
    std::cout << "Enter the passing grade (1-100): ";
    std::cin >> passing;
        
    if (grade >= passing)
    {
        std::cout << "\nPass\n";
    }
    else
        std::cout << "\nFail\n";
 
    return 0;
}

Result

Related Exercise