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
Svetllana [295]
2 years ago
6

Write a program that prints the question " Do youwant to continue? " and reads a user input. if the userinput is " Y ", " OK", o

r " Why not? ", printout " OK ". if the user input is "No " , then print out " Terminating ", Otherwise print " Bad input". The case of the user input should notmatter. For example, "y" or "yes" are also valid inputs. Write aclass YesNoChecker for this purpose.
Computers and Technology
1 answer:
Nataly_w [17]2 years ago
7 0

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

   string in;//string in for taking input...

   cout<<"Do you want to continue ?"<<endl;

   getline(cin,in);//taking input from the user...

   if(in=="y"||in=="Y"||in=="yes"||in=="OK"||in=="Why not?")//conditions..

   cout<<"OK"<<endl;

   else if(in=="No")

   cout<<"terminating"<<endl;

   else

   cout<<"Bad input"<<endl;

return 0;

}

Explanation:

I have taken a string in.

Then taking input from user.

Checking the conditions using if else if ladder.

You might be interested in
Which of the following is considered both an input and output peripheral? Keyboard, Microphone, Speaker, Touchscreen monitor
Aleks04 [339]
Touchscreen monitor.
6 0
3 years ago
Read 2 more answers
Computers and Technology:
Monica [59]

Answer:

The algorithm:

Input days

sum = 0

for i = 1 to days

   input text

   sum = sum + text

end for

average = sum/days

print average

The program in pascal:

var days, sum, text, i:integer;

var average : real;

Begin

    write ('Days: '); readln(days);

    sum:=0;

    for i := 1 to days do begin

         write ('Text: ');  readln(text);  

         sum:=sum+text;

    end;

    average := (sum/days);

    writeln ('The average text is' , average);

End.

Explanation:

This declares all variables

var days, sum, text, i:integer;

var average : real;

This begins the program

Begin

This gets the number of days from the user

    write ('Days: '); readln(days);

Initialize sum to 0

    sum:=0;

This iterates through the days

    for i := 1 to days do begin

This gets the text for each day

         write ('Text: ');   readln(text);  

This sums up the texts

         sum:=sum+text;

End loop

    end;

Calculate average

    average := (sum/days);

Print average

    writeln ('The average text is' , average);

End program

End.

3 0
3 years ago
How do you create a function in C++
MArishka [77]

Answer:

1. Declaration: the return type, the name of the function, and parameters (if     any)

2. Definition: the body of the function (code to be executed)

Explanation:

7 0
1 year ago
What behaviors are most common in a successful entrepreneurship
Kryger [21]
1. Proper planning
2. Honesty
3. Being reasonable in pricing
4. Knowledge of what you’re offering
5. Being kind/good to your clients
8 0
3 years ago
Http://moomoo.io/?server=8:16:0
love history [14]

Explanation:

noooooooooooooooooooooooooooooooooo

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write the importance of cyber law? In point .<br>​
    10·2 answers
  • “Green Technology” is also known as what?
    11·1 answer
  • Which one of these students is having a positive impact?
    8·2 answers
  • What do you believe are the motives of a cyber criminal? Why?
    15·1 answer
  • Florida Highway Safety and Motor Vehicles reported blank of traffic fatalities were alcohol-related in Florida in 2009.​
    8·1 answer
  • . Identify an emerging crime issue in your community using data available from sources such as local newspapers, online police r
    6·1 answer
  • How do governments correct for negative externalities?
    5·1 answer
  • Pleas help 99 points and get brainliest
    9·2 answers
  • ________ was one of the first uses of the Internet
    15·2 answers
  • Write a sed command that will display all lines of the birthday file that do not contain the string March. What was the sed comm
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!