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
Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hou
lisov135 [29]

Answer:

public class Clock

// create the class

{

private int hours;

// variable declaration of  hours

private boolean isTicking;

// variable declaration of boolean

private Integer diff;

 // variable declaration of  diff

}

Explanation:

Following are the description of the above code  

  • Firstly create the class called To Create any class we use the keyword class followed by the class name.
  • In the class, we declared three variable one type integer called " hours" The second is type boolean called "isTicking" and the last one is also integer called "diff".
  • They all are three variables are private it means they are not accessible outside the class.
4 0
2 years ago
What computer is designed for particular application​
Karo-lina-s [1.5K]

Answer: Applications for desktop or laptop computers are sometimes called desktop applications, while those for mobile devices are called mobile apps. When you open an application, it runs inside the operating system until you close it

Explanation:

5 0
2 years ago
Write a program that (a) generates a vector with 20 random integer elements with integers between -29 and 30, (b) replaces all t
Ghella [55]

Answer:

import random

randomlist = []

for i in range(0,20):

n = random.randint(-29,30)

if n < 0 :

n = 100

randomlist.append(n)

print(randomlist)

Explanation:

The random module is first imported as it takes care of random. Number generation.

An empty list called randomliay is created to hold the generated random integers.

Using a for loop, we specify the range of random numbers we want.

Inside the for loop ; we attach our generated random integer which will be in the range (-29 to 30) in a variable n

For each n value generated, if the value is less than 0( it is negative, since all the values are integers), replace the value with 100.

5 0
2 years ago
Need help ASAP <br><br> Thankss + BRAINLIST only for correct answers
AVprozaik [17]
Why visit it?
For entertainment, purely for the user to enjoy the content that has been produced for them.

Why was it made?
Netflix is a subscription based service that has been made to allow users to stream TV shows and other entertainment sources. It was made for leisure.
7 0
2 years ago
Change the file name for index.html to index.php
Damm [24]

The PHP code is given below:

<h3>PHP code</h3>

if(isset($_REQUEST['login_btn'])){

       $email = filter_var(strtolower($_REQUEST['email']),FILTER_SANITIZE_EMAIL); //strtolower changes email to all lower case

       $password = strip_tags($_REQUEST['password']);

The remaining code is in the file attached.

 

Read more about PHP here:

brainly.com/question/27750672

#SPJ1

Download txt
4 0
1 year ago
Other questions:
  • What information is not typically included in an e-mail header?​?
    15·1 answer
  • Which information is considered free for use?
    9·2 answers
  • Siva added a "Contact Form" to her website.
    10·1 answer
  • Which of these programmers creates the core game engine?
    5·2 answers
  • All NATE specialties are offered at two levels, A. journeyman and master. B. installation and service. C. apprentice and journey
    7·1 answer
  • What are the names of the four major varnas in the caste system?​
    9·2 answers
  • Pls Help need it before 1pm PLS.
    15·2 answers
  • Which expression is equivalent to 3x + 3x + 3x?<br><br> From Performance Matters
    11·2 answers
  • PLZ HELP! ANSWER (WITH CORRECT ANSWER AND EXPLANATION THAT ACTUALLY IS CORRECT) GETS BRAINLIEST!
    13·1 answer
  • Unconformities develop when new sedimentary layers accumulate atop old, eroded layers, resulting in a geologic hiatus. Which of
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!