Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7.  
  8. {
  9. int option;
  10. int score = 105;
  11. double gpa;
  12. do {
  13. cout << "Menu:\n"
  14. << "1. Enter your testscore \n"
  15. << "2. Enter your GPA to see if you made the deans list \n"
  16. << "3. Exit\n"
  17. << "Enter an option by entering 1, 2, or 3: ";
  18.  
  19. cin >> option;
  20. cout << endl;
  21.  
  22.  
  23. switch (option)
  24. {
  25. case 1:
  26. cout << " You chose option one" << endl;
  27. cout << "Enter your test score" << endl;
  28. cin >> score;
  29. cin.clear();
  30.  
  31. cin.ignore(200, '\n');
  32.  
  33. if (score >= 90 && score <= 100) {
  34. cout << "The grade is an A" << endl;
  35. }
  36. else if (score >= 80 && score < 90) {
  37. cout << "The grade is a B" << endl;
  38. }
  39. else if (score >= 70 && score < 80) {
  40. cout << "The grade is a c" << endl;
  41. }
  42. else if (score >= 60 && score < 70) {
  43. cout << "The grade is a D" << endl;
  44. }
  45. else if (score >= 0 && score < 60) {
  46. cout << "The grade is a F" << endl;
  47. }
  48.  
  49. else {
  50. cout << "Your score is out of range" << endl;
  51. }
  52. break;
  53.  
  54. case 2:
  55. cout << "You chose option two\n";
  56. cout << "Enter your GPA" << endl;
  57. cin >> gpa;
  58.  
  59. if (gpa >= 3.9 && gpa <= 4.0) {
  60.  
  61. cout << "You're on the deans list." << endl;
  62. }
  63. else if (gpa >= 0 && gpa < 3.8) {
  64. cout << "You're not elligible for the deans list." << endl;
  65. }
  66. else {
  67. cout << "Your gpa is out of range" << endl;
  68. }
  69. break;
  70.  
  71. case 3:
  72. cout << "You chose to exit, thank you.\n";
  73. break;
  74.  
  75. default:
  76. cout << "Invalid option, please enter 1, 2, or 3.\n";
  77. }
  78.  
  79.  
  80. }
  81.  
  82. while (option != 3);
  83.  
  84. return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement