fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void Grade(int x) {
  5. if (x > 100 || x < 0) {
  6. cout << "The degree is wrong! Try again." << endl;
  7. }
  8. else if (x >= 90) {
  9. cout << "Your Grade is 'A'" << endl;
  10. }
  11. else if (x < 90 && x >= 80) {
  12. cout << "Your Grade is 'B'" << endl;
  13. }
  14. else if (x < 80 && x >= 70) {
  15. cout << "Your Grade is 'C'" << endl;
  16. }
  17. else if (x < 70 && x >= 60) {
  18. cout << "Your Grade is 'D'" << endl;
  19. }
  20. else {
  21. cout << "Your Grade is 'F'" << endl;
  22. }
  23.  
  24. }
  25. int main()
  26. {
  27. int g;
  28. cout << "Enter your grade: ";
  29. cin >> g;
  30. Grade(g);
  31. }
  32.  
  33.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Enter your grade: The degree is wrong! Try again.