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
Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consisting of a single positive in
Reika [66]

Answer:

see explaination for program code

Explanation:

scalar_product = 0

li=[]

li2=[]

#reading numbers1.txt and numbers2.txt intoli and li2 respectively

with open('numbers1.txt') as n1, open('numbers2.txt') as n2:

for line1 in n1:

li.append(int(line1))

for line2 in n2:

li2.append(int(line2))

#storing min list size into variable l

a=len(li)

b=len(li2)

if a<b:

l=a

else:

l=b

#calculating scalar product

for i in range(l):

scalar_product=scalar_product+li[i]*li2[i]

print("scalar product is",scalar_product)

6 0
3 years ago
1. A pure aggregator is best defined as a blog that
miss Akunina [59]
A pure aggregator is best defined as a blog that aggregates blog content from other sources.

An Aggregator blog or website don't write its own content. It aggregates information or content from third-party websites. There are different types of aggregator websites such as a poll aggregator, a review aggregator, and a search aggregator.
5 0
3 years ago
Which of the following need NOT be completed separately if a worksheet is prepared?
Anika [276]
C because you already have you sheet prepared
3 0
3 years ago
Which program will have the output shown below?
MariettaO [177]

Answer:

for count in range(12,15)

Explanation:

This is a 'For' loop in python programming language and it take two or three arguments, the include: start, stop, step)

from the options given we only have two arguments (start, stop)

from my answer, the loop will begin from 12 and ends at (n-1) that's why it prints out 12, 13, and 14 only.

7 0
2 years ago
Word inserts text to the right of the insertion point. true false
Snowcat [4.5K]
Correct Answer:
False

Reasoning:
The insertion point is the blinking vertical line in your document. It indicates where the letters are going to be put when you type them. When you type the insertion point stays ahead of the words. therefor word inserts text to the right of the insertion point. 

Source:
I have taken a Microsoft Word class. 
6 0
3 years ago
Other questions:
  • What color model should Joe use if he will be using an offset printing press?
    7·1 answer
  • You support Richman Investments, a brokerage firm that employs 20 brokers. Each broker has his own client computer, and the firm
    15·1 answer
  • [ANSWER = BRAINLIEST] How to mark an answer as brainliest?
    13·2 answers
  • My speaker on my phone is not working, when I try and play music and videos the sound dosen't work. However my alarm works. Can
    9·2 answers
  • What is targets net worth in 2020 (i will see if you put in 2019)
    11·1 answer
  • A group of students is performing an investigation to measure how much liquid water is produced from a 10 L sample of snow. What
    6·1 answer
  • State the keyboard key used to move the cursor to the line​
    10·1 answer
  • List 5 differences between monitors and printers​
    14·1 answer
  • Primary memory consists of the various devices that are able to store data and programs even when the power is off. true or fals
    11·1 answer
  • Write a Pascal program that will prompt the user to enter the radius of a circle.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!