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
Genrish500 [490]
3 years ago
13

Write a do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The user shoul

d be asked if he or she wishes to per- form the operation again. If so, the loop should repeat; otherwise it should terminate.
Computers and Technology
1 answer:
iVinArrow [24]3 years ago
5 0

The do-while loop for the given problem is shown below.  

do  

{  

  // user asked to enter two numbers  

  cout<<"Enter two numbers to be added."<<endl;  

  cin>>num1;  

  cin>>num2;  

  sum = num1 + num2;  

 

  // sum of the numbers is displayed  

  cout<<"Sum of the two numbers is "<<sum<<endl;  

  // user asked whether to perform the operation again  

  cout<<"Do you wish to continue (y/n) ?"<<endl;  

   cin>>choice;  

}while(choice != 'n');  

The variables to hold the two numbers and their sum are declared as float so that the program should work well for both integers and floating numbers.

float num1, num2, sum;

The char variable is taken since it holds only a single-character input from the user, 'y' or 'n'.

char choice;

The whole program is given below.

#include <iostream>

using namespace std;

int main() {

float num1, num2, sum;

char choice;  

do  

{  

  // user asked to enter two numbers  

  cout<<"Enter two numbers to be added."<<endl;  

  cin>>num1;  

  cin>>num2;  

  sum = num1 + num2;  

  // sum of the numbers is displayed  

  cout<<"Sum of the two numbers is "<<sum<<endl;  

  // user asked whether to perform the operation again  

  cout<<"Do you wish to continue (y/n) ?"<<endl;  

  cin>>choice;  

}while(choice != 'n');

cout<<"Quitting..."<<endl;

}

You might be interested in
The physical parts of the computer that you can see and touch are called______.
Tatiana [17]
Physical parts of computer: Computer Hardware
5 0
2 years ago
Which of the following solutions enables simultaneous digital transmission of voice, video, data, and other network services ove
Annette [7]

Answer:

3. ISDN

Explanation:

ISDN ( Integrated Services Digital Network  ) -

It is the used for the simultaneous digital transmission of network service , data , video and voice , instead of the old circuits of the public switched telephone network ( PSTN ) , is referred to as ISDN .

The characteristic feature of ISDN is that it integrates the data and speech on the same lines , which is not possible in PSTN .

Hence, from the given information of the question,

The correct option is ISDN .

8 0
2 years ago
Describe a situation involving making a copy of a computer program or an entertainment file of some sort for which you think it
Margaret [11]

Answer:

Copying anything may be the computer program or an entertainment file, it is not a good thing as the original developers or the writers are going to feel bad since their hard work is being used by others without letting them know. However, if you are using it for academic purposes, or give them credit in your work, then the original writer will not feel that bad as he is being credited, and hence you can reuse in that case definitely, but always ensure to give the credit to the original writer.

As an example, if a film is copied like many in the past the Directors always feel bad, and they have the reason for feeling bad. The same thing is to technology.

Explanation:

The answer is self explanatory.

8 0
3 years ago
What is the purpose of the property, transition-timing-function?
oksano4ka [1.4K]

Answer:

It changes the speed at different stages of the transition.

Explanation:

HTML is an acronym for hypertext markup language and it is a standard programming language which is used for designing, developing and creating web pages.

Generally, all HTML documents are divided into two (2) main parts; body and head. The head contains information such as version of HTML, title of a page, metadata, link to custom favicons and CSS etc. The body of the HTML document contains the contents or informations that a web page displays.

Basically, the purpose of the property, transition-timing-function is that It changes the speed at different stages of the transition. Thus, it states the values between the beginning and ending of a transition are calculated over its duration.

4 0
3 years ago
Where should you look in order to find words as they are used in a variety of contexts?
Elodia [21]
You'd want to look at the <span>glossary.</span>
8 0
2 years ago
Other questions:
  • You are a disgruntled employee with a master’s degree in computer sciences who was recently laid off from a major technology com
    11·1 answer
  • A major problem with alcohol adverstising is that
    15·1 answer
  • Write a C program that includes a function of type double called divemaster accepts two double arguments (you must write the div
    15·1 answer
  • What process periodically validates a user’s account, access control, and membership role on inclusion in a specific group?a. Re
    12·1 answer
  • Customizing ads to people who had earlier visited the site is
    14·1 answer
  • Computers help eliminate the repetitiveness of manual tasks. How can this benefit you in your overall career?
    9·2 answers
  • Power point presentation make use of pages known as
    9·2 answers
  • Can someone write this in java? Also, does anyone know how to do Edhesive assignments?
    15·1 answer
  • Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string
    10·1 answer
  • scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!