Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ programming please i need the code of this homework.. Lecture 7. ELSE IF 1.

ID: 3583966 • Letter: C

Question

C++ programming

please i need the code of this homework..

Lecture 7. ELSE IF

1. example

if (x > 90){

   printf("the grade is A ");

} else if (x > 80){

   printf("the grade is B ");

} else if (x > 70){

   printf("the grade is C ");

} else {

   printf("the grade is F ");

}

2. Homework

1) Read a score and display the grade.

Enter a score

77

Your grade is C.

2) Design the following menu system. Your code should display "there is no such menu" if the user selects an illegal menu.

Enter a menu number: rice(1), bread(2), drink(3), noodle(4)

3

You have selected a drink.

Explanation / Answer

#include<iostream>

int main()
{
   /// 1 and 2 /////////////
   int x;
   cout << "Enter value for x";
   cin >>x;
   if (x > 90){
printf("the grade is A ");
   } else if (x > 80 && x <=90){
   printf("the grade is B ");
   } else if (x > 70 && x <=80){
   printf("the grade is C ");
   } else {
   printf("the grade is F ");
   }
  
  
   ////////////////////3 ///////////////
   int choice;
  
   cout <<"Enter menu number: rice(1), bread(2), drink(3), noodle(4)";
   cin >> choice;
  
   switch (choice)
   {
       case 1:
       cout <<"You have selected rice";
       break;
       case 2:
       cout <<"You have selected bread";
       break;
       case 3:
       cout <<"You have selected drink";
       break;
       case 4:
       cout <<"You have selected noodle";
       break;
       default:
          
       cout <<"There is no such menu";
      
  
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote