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]
3 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]3 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
Tax preparation software can help prepare and file your taxes by _________.
OverLord2011 [107]
Tax preparation software can help prepare and file your taxes by April 15.
4 0
2 years ago
I got a 52 on my test :(
Eduardwww [97]

Answer:

that sucks i hope u can do better next time have a good day

Explanation:

7 0
3 years ago
1 Which one of the following is a transmission
ElenaW [278]

Answer:

d

Explanation:

All of the above can be means by which signals or information is transferred.

5 0
2 years ago
You type a complex formula in cell A20. You would like to make the same calculation in cells B20 through H20. To be efficient, y
fomenos

Answer:

Use autofill

Explanation:

In excel "autofill" is used to fill data in cells, which follows the pattern or logic applied in other cells. To apply same calculation of A20 in B20 to H20, we use autofill technique. Instead of copy pasting, or manually entering the complex formula this method is more suitable.  

4 0
3 years ago
What is a coaxial cable?
grin007 [14]

Answer:

A transmission line that consists of a tube of electrically conducting material surrounding a central conductor held in place by insulators and that is used to transmit telegraph, telephone, television, and Internet signals.

Coax, short for coaxial, is a type of cable used to transmit data, the internet, video and voice communications. A coax cable is made up of an aluminum and copper shield with an outer plastic jacket (see below) with the dielectric insulator helping to minimize signal loss.

5 0
1 year ago
Other questions:
  • Assume that word is a variable of type String that has been assigned a value. Assume furthermore that this value always contains
    13·2 answers
  • Define graphics packaging​
    6·1 answer
  • The natural functions of Earth seem all _____ in one way or another.
    9·1 answer
  • If you were looking for a record in a very large database and you knew the ID number, which of the following would be the most d
    6·1 answer
  • As a computer science student, which career you will select and what do you predict about the future of that specific IT-Career.
    8·1 answer
  • Which hardware device connects your network to the internet? select one:
    15·1 answer
  • Credence is a student in college.
    13·2 answers
  • Give an explanation of one network connection (it will every helpful​
    13·1 answer
  • Why do we need operating systems?
    7·1 answer
  • Criminal investigations are limited to finding data defined in the search ____.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!