1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sleet_krkn [62]
3 years ago
13

Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unknown" (followe

d by a newline) if the value of userItem does not match any of the defined options. For example, if userItem is GR_APPLES, output should be:Fruit#include int main(void) {enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};enum GroceryItem userItem = GR_APPLES;/* Your solution goes here */return 0;}

Computers and Technology
1 answer:
Sloan [31]3 years ago
5 0

Answer:

Here is the complete code

#include <iostream>  //for input output functions

using namespace std;   //to identify objects like cin cout

int main() {  //start of main() function body

  enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};  //enum is used to assign names to constant

  GroceryItem userItem = GR_APPLES;  

//value of userItem is set to GR_APPLES

  /* Your solution goes here  */

//if the userItem is equal to GR_APPLES or GR_BANANAS

if((userItem == GR_APPLES) || (userItem == GR_BANANAS)){

 cout << "Fruit";  } //display Fruit if above if condition is true

//if the value of userItem is equal to GR_JUICE or GR_WATER

else if((userItem == GR_JUICE) || (userItem == GR_WATER)){

 cout << "Drink";  } //display Drink if the above if condition is true

else{  //if none of the above if conditions is true then print Unknown

 cout << "Unknown";  }  

cout << endl;

  return 0;  }

Explanation:

The output of the program is Fruit because the value of userItem is set to GR_APPLES and according to the if statement if the userItem is equal to GR_APPLES than "Fruit" will be displayed on the screen as output.

The program along with its output is attached as a screen shot.

You might be interested in
Physical education is the body's ability to function effectively and efficiently without excessive farigue. TRUE/FALSE
Salsk061 [2.6K]

Answer: True

Explanation:

6 0
2 years ago
Rtjfifjjir<br> jhjjbkjkjjgggjhvhjvhf
V125BC [204]
Skakskdnsmakakkskzskskslslskakidfjjfueiskxncjowkcnjsosldnxnxisoszmsmzkakaskzkkz 浜はまはまはたはまりまる
6 0
3 years ago
___signs tell you what you can or can't do, and what you must do ?
Harrizon [31]

Answer:

Warning signs tell you can or can't do, and what you must do?

5 0
3 years ago
Read 2 more answers
The______for our newest game keeps changing as we develop our concept and refine our goals.
antiseptic1488 [7]
I think d is the best here
6 0
3 years ago
Read 2 more answers
Which of the following questions will most likely be answered by displaying data on a line graph?
Artemon [7]
I'm pretty sure the answer is b
4 0
3 years ago
Other questions:
  • Which of the following is an example of a direct payment subsidy?
    12·1 answer
  • In order for Dr. Reynolds to send a CPOE from her office computer system to the computer system at the local hospital, a/an ____
    5·1 answer
  • Give the Division Hashing function and the index it maps the key 2000 into, assuming a primary storage area array size of 61 ele
    6·1 answer
  • How do you change your age on Brainly?
    10·1 answer
  • In the design phase of the systems development life cycle (SDLC), the _____ design is an overview of the system and does not inc
    10·1 answer
  • What are 25 items that trees made?
    6·2 answers
  • Convert the decimal integer, 353.87510 to each of these forms:
    9·1 answer
  • Which of the following are NOT possible using the RANDOM(a, b) and DISPLAY(expression) abstractions?
    10·1 answer
  • Write a program to simulate a Fruit Machine that displays three symbols at random from Cherry, Bell, Lemon, Orange, Star, Skull.
    11·1 answer
  • Page Setup options are important for printing a PowerPoint presentation a certain way. The button for the Page Setup dialog box
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!