Answered Essay: Go through this drill step by step. Do not try to speed up by skipping steps. Test each step by entering at least three pairs o

C++
Go through this drill step by step. Do not try to speed up by skipping steps. Tes each step by entering at least three pairs of values more values would be better 1. Write a program that consists of a while-loop that (each time around the loop) reads in two ints and then prints them. Exit the program when a terminating l is entered. 2. Chan ge the program to write out the smaller value is: followed by smaller of the numbers and the larger value is: followed by the larger value 3. Augment the program so that it writes the line the numbers are equal (only) if they are equal. t. Change the program so that it uses doubles instead of ints. 5. Change the program so that it writes out the numbers are almost equal after writing out which is the larger and the smaller if the two numbers differ by less than 1.0/100. 6. Now change the body of the loop so that it reads just one double each time around. Define two variables to keep track of which is the smallest and which is the largest value you have seen so far. Each time through the loop write out the value entered. If its the smallest so far, write the smallest so far after the number. If it is the largest so far, write the largest so far after the number 7. Add a unit to each double entered; that is, enter values such as 10cm, 2.5in, 5ft, or 3.33m. Accept the four units: cm, m, in, ft. Assume con version factors 1m 100cm, 1.n = 2.54cm, 1ft == 12in. Read the unit indicator into a string. You may consider 12 m (with a space between the number and the unit) equivalent to 12m (without a space). 8. Reject values without units or with llegal representations of units, such as y, yard, meter, km, and gallons track of the sum of values entered (as well as the smallest and the largest) and the number of values entered. When the loop ends, print the smallest, the largest, the number of values, and the sum of values. Note that to keep the sum, you have to decide on a unit to use for that sum; use meters 10. Keep all the values entered (converted into meters) in a vector. At the 11. Before writing out the values from the vector, sort them (thatll make end, write out those values. them come out in increasing order).

Go through this drill step by step. Do not try to speed up by skipping steps. Test each step by entering at least three pairs of values-more values would be better. Write a program that consists of a while-loop that (each time around the loop) reads in two ints and then prints them. Exit the program when a terminating ‘|’ is entered. Change the program to write out the smaller value is: followed by the smaller of the numbers and the larger values is: followed by the larger value. Augment the program so that it writes the line the numbers are equal (only) if they are equal. Change the program so that it uses doubles instead of ints. Change the program so that it writes out the numbers are almost equal after writing out which is the larger and the smaller if the two numbers differ by less than 1.0/100. Now change the body of the loop so that it reads just one double each time around. Define two variables to keep track of which is the smallest and which is the largest value you have seen so far. Each time through the loop write out the value entered. If it’s the smallest so far, write the smallest so far after the number. If it is the largest so far, write the largest so far after the number. Add a unit to each double entered: that is, enter values such as 10cm, 2.5in, 5ft, or 3.33m. Accept the four units: cm. m, in, ft. Assume conversion factors 1m == 100cm, l in == 2.54cm, 1ft == 12in. Read the unit indicator into a string. You may consider 12 m (with a space between the number and the unit) equivalent to 12m (without a space). Reject values without units or with “illegal” representations of units, such as y, yard, meter, km, and gallons. Keep track of the sum of values entered (as well as the smallest and the largest) and the number of values entered. When the loop ends, print the smallest, the largest, the number of values, and the sum of values. Note that to keep the sum, you have to decide on a unit to use for that sum: use meters. Keep all the values entered (converted into meters) end, write out those values. Before writing out the values from the vector, sort them (that’ll make them come out in increasing order).

Expert Answer

 

1.

#include<iostream>

using namespace std;

int main()

{

int x, y;

// infinite loop

while(1)

{

cout<<“Enter x and yn”;

// scan x and y

cin>>x>>y;

cout<<“x : “<<x<<“ny : “<<y<<“nn”;

cout<<“To exit press |, else print anything elsen”;

char ch;

// scan ch

cin>>ch;

if(ch == ‘|’)

// break out of the loop

break;

}

return 0;

}

Sample Output :

2.

#include<iostream>

using namespace std;

int main()

{

int x, y;

// infinite loop

while(1)

{

cout<<“Enter x and yn”;

// scan x and y

cin>>x>>y;

// get the smaller element

int smaller = (x < y) ? x : y;

// get the smaller element

int larger = x + y – smaller;

cout<<“Smaller elemet : “<<smaller<<“nLarger Element : “<<larger<<“nn”;

cout<<“To exit press |, else print anything elsen”;

char ch;

// scan ch

cin>>ch;

if(ch == ‘|’)

// break out of the loop

break;

cout<<endl;

}

return 0;

}

Sample Output :

3.

#include<iostream>

using namespace std;

int main()

{

int x, y;

// infinite loop

while(1)

{

cout<<“Enter x and yn”;

// scan x and y

cin>>x>>y;

if(x == y)

cout<<“the numbers are equaln”;

cout<<“To exit press |, else print anything elsen”;

char ch;

// scan ch

cin>>ch;

if(ch == ‘|’)

// break out of the loop

break;

cout<<endl;

}

return 0;

}

Sample Output :

4.

#include<iostream>

using namespace std;

int main()

{

double x, y;

// infinite loop

while(1)

{

cout<<“Enter x and yn”;

// scan x and y

cin>>x>>y;

cout<<“x : “<<x<<“ny : “<<y<<“nn”;

cout<<“To exit press |, else print anything elsen”;

char ch;

// scan ch

cin>>ch;

if(ch == ‘|’)

// break out of the loop

break;

}

return 0;

}

Sample Output :

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.