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
alexira [117]
2 years ago
14

A boolean variable named rsvp an int variable named selection, where 1 represents "beef", 2 represents "chicken", 3 represents "

pasta", and all other values represent "fish" a String variable named option1 a String variable named option2. Write a code segment that prints "attending" if rsvp is true and prints "not attending" otherwise. Write the code segment below.
Computers and Technology
1 answer:
Maru [420]2 years ago
6 0

Answer:

int main()

{

   bool rsvp;

   string option1,option2="Not attending";

   int selection;

   cin>>rsvp;    //rsvp value to be entered by user

   if(rsvp=true)     //to check if rsvp is true

   {

       cin>>selection;     //only if rsvp is true then selection's value would matter

       switch(selection)             //to appoint right value to option1

       {

           case 1 : option1="Attending you will be served beef";

           exit;

           case 2 : option1="Attending you will be served chicken";

           exit;

           case 3 : option1="Attending you will be served pasta";

           exit;

           default : option1="Attending you will be served fish";   //any other integer will have value fish

           exit;

       }

       cout<<option1;

   }

   else

       cout<<option2;      //if false then option2 will be printed

   return 0;

}

Input :

true

2

Output :

Attending you will be served chicken

Explanation:

The question is incomplete as it has missed other 2 code segments which states that option1 and option2 are printed strings which tells attending or not attending. Also, selection is the integer value for the food to be served if attending or rsvp is true.

In the above code, first rsvp value is taken from the user and checked if true or false. If rsvp is true then selection is read from user as otherwise its value won't matter. Then option1 string is initiated according to the va.lue given and printed to the user. If rsvp is false then direct option2 string is outputted which is "not attending".

You might be interested in
State and explain three importance of internet education​
Ne4ueva [31]

Answer:

It can improve the quality of education in many ways. It opens doorways to a wealth of information, knowledge and educational resources, increasing opportunities for learning in and beyond the classroom. Teachers use online materials to prepare lessons, and students to extend their range of learning

Explanation:

4 0
2 years ago
Read 2 more answers
Switched backbone networks:_____.a. always use a ring topology.b. require much more management that do routed backbone networks.
Gre4nikov [31]

Answer:

c

Explanation:

spongo  

7 0
3 years ago
What three files do you need to perform a mail merge?<br><br> HELP ASAP PLEASE!!
Burka [1]

The 3 files you need to have for a successful mail merge are:

  • An Excel spreadsheet works
  • Outlook Contact List.
  • Apple Contacts List or Text file, etc.

<h3>What is Mail Merge?</h3>

This is known to be the act of carrying out  a Mail Merge and it is one where a person will need to use a Word document and a recipient list, that is an Excel workbook.

Files needed are:

  • Text file,
  • address files, etc.

The 3 files you need to have for a successful mail merge are:

An Excel spreadsheet worksOutlook Contact List.

Apple Contacts List or Text file, etc.

Learn more about mail merge from

brainly.com/question/20904639

#SPJ1

4 0
1 year ago
BRAINLIEST plz help
avanturin [10]

Answer:C

Explanation:

8 0
3 years ago
During the course of execution of a program, the processor will increment the contents of the instruction register (program coun
Oksana_A [137]
Bdbdbdhdhdhdhdjdbsbbrvrvrrvrvrvfvfvvfvfvfvfvfhdhdhdhdhdhdhhdududududududuebebbedvdvd I known why ahh it happened
8 0
2 years ago
Other questions:
  • Define a method pyramidVolume with double parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volu
    11·2 answers
  • Discuss some design considerations that you should keep in mind when you want to design a professional-looking flyer or newslett
    12·1 answer
  • An ink-jet printer is a type of impact printer. <br> a. True <br> b. False
    8·1 answer
  • True or False: Changing a bid package's status to "Closed" removed it from the bidder's Planroom and the bidder will no longer b
    15·1 answer
  • Plz subscribe my yt gaming channel <br>FIREAZZ GAMING​
    8·2 answers
  • I'm not sure how to do these. By the way, it has to be python.
    13·1 answer
  • Which one way in which using infrared in game console controllers could affect the experience of a person playing the game?
    8·1 answer
  • What is a word processing program? Give examples of word processing programs.
    10·1 answer
  • What is your favorite anime ( All movies and episodes related to them count )
    8·2 answers
  • ________ is interpreted. Group of answer choices A. Python B. C C. C D. Ada E. Pascal
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!