Question

In: Electrical Engineering

makes it in c++ Kyal is in line at the DMV he has number 325, they...

makes it in c++

Kyal is in line at the DMV he has number 325, they are currently serving customer 320.

Use a switch statement to determine which type of loop he needs to use to count to his turn being called.
f = for loop w = while loop d = do-while loop
Output the appropriate loop type from the switch.

Then use any loop type to get from 320 to 325.

Select the appropriate loop type f= for, w =while, d= do-while
[output of appropriate loop type]
320
321
322
323
324
325
It is your turn

the projram starts her..

#include <iostream>
using namespace std;

int main() {

   // Declare appropriate variables
    int number = 320;
   
    //Output the prompt & recieve input
    cout << "Select the apropriate loop type f= for, w =while, d= do-while" << endl;
   
    //Switch to determine & output the appropriate loop type
   
   
    //Loop that goes from 320 to 325 and outputs each number then "It's your turn"
   
   

   return 0;
}

Solutions

Expert Solution

#include <iostream>

using namespace std;

string name="its ur turn";

int num=320;

int main()

{

// Declare char variable for taking character and functions fr(),whle(),dowhile() for display numbers from 320 to 325 using while,for,do-while loops

char o;

void fr();

void whle();

void dowhile();

cout << "Select the appropriate loop type f=for,w=while,d=do-while"<<endl;

cin >> o;

switch (o)

{

case 'f':

fr();

break;

case 'w':

whle();

break;

case 'd':

dowhile();

break;

default:

cout << "Invalid Choice. Enter f or w or d";

break;

}

  

return 0;

}

void fr() // function for displaying numbers 320 to 325 using for loop

{

for(int num=320;num<=325;num++)
{
cout << num << endl;
}
cout << name << endl;
return ;

}

void whle() //function for displaying numbers 320 to 325 using while loop

{

while(num<=325)

{

cout << num << endl;

num++;

}

cout << name << "\n";

return;

}

void dowhile() //function for displaying numbers 320 to 325 using do-while loop

{

do{

cout << num << endl;

num++;

}while( num <= 325 );
cout << name << "\n";
}


Related Solutions

A local Division of Motor Vehicles (DMV) is concerned with its waiting line system. Currently, the...
A local Division of Motor Vehicles (DMV) is concerned with its waiting line system. Currently, the DMV uses a single-server, single-line, single-phase system when processing license renewals. Based on historical evidence, the average number of customers arriving per hour is 9 and is described by a Poisson distribution. The service rate is 12 customers per hour with the service times following an exponential distribution. The customers are patient and come from an infinite population. The manager of the DMV would...
A 325-mL sample of air is at 720.0 torr and 30.0 °C. When the temperature is...
A 325-mL sample of air is at 720.0 torr and 30.0 °C. When the temperature is increased to 60.0 °C and the pressure is increased to 900.0 torr, the new volume of the gas will be _______ mL.
What is the mass of Carbon (C) in milligrams found in 325 mg of aspirin (C9H8O4)?
What is the mass of Carbon (C) in milligrams found in 325 mg of aspirin (C9H8O4)?
The distribution of the number of people in line at a grocery store checkout has a...
The distribution of the number of people in line at a grocery store checkout has a mean of 3 and a variance of 9. A sample of the numbers of people in 50 grocery store checkout lines is taken. (a) (3 points) What’s the probability that the sample mean is less than 4.5? Round your answer to four (4) decimal places. (b) (3 points) What’s the probability that the sample mean is more than 2.25? Round your answer to four...
The driver’s license office DMV has asked you to write a program that grades the written...
The driver’s license office DMV has asked you to write a program that grades the written portion of the driver’s license questions. The questions has 20 multiple-choice questions. Here are the correct answers: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 B D A A A C B C D A D C C D D B A B C D Your program should store these correct answers...
If a person has an option to assume a loan and therefore create a $325 mortgage...
If a person has an option to assume a loan and therefore create a $325 mortgage payment savings with the following known factors, 20 years left on the loan (240 months), original loan rate is 3% and the current market rate is 4.5%. What is the Present Value of the payment savings? $56,285 $57,687 $51,371 $58,601
Jack and Jill are in the checkout line at Walmart. In Jack’s basket he has 4...
Jack and Jill are in the checkout line at Walmart. In Jack’s basket he has 4 DIGIORNO Original Thin Crust Supreme Frozen Pizza and 2 half-gallons of Blue Bell Chocolate Chip Cookie Dough. Jill has in her basket 6 of the DIGIORNO pizzas and 1 half-gallon of the Blue Bell ice cream. You know that the pizza are selling for $5.00 each while ice cream costs $4.00 per half-gallon. If both Jack and Jill are utility maximizers, which of the...
Q2/ Superheated steam enters convergent divergent nozzles at (2 MN/m²) and ( 325 C°) with mass...
Q2/ Superheated steam enters convergent divergent nozzles at (2 MN/m²) and ( 325 C°) with mass flow rate (7.5 kg/sec ). It is expand according to (PV 13= C) through the nozzles until exit, while the exit pressure (0.36 MN/m³) Calculate 1/throat and exit diameter. 2/temperature degree of undercooling at exit.
Namaste, Inc. makes a line of bathroom accessories. A decline in sales has left the organization...
Namaste, Inc. makes a line of bathroom accessories. A decline in sales has left the organization with 10,000 machine hours of idle capacity at their disposal each year. This idle capacity could be used by the company to manufacture, rather than buy, one of the pieces used in its production process. Namaste needs 5,000 units of this component each year. This component is currently being purchased from an outside supplier at $7.50 per unit. Variable production cost for the component...
Helium (He) has an Atomic Number Z=2 and an atomic mass of 4.002602. It has eight...
Helium (He) has an Atomic Number Z=2 and an atomic mass of 4.002602. It has eight isotopes. One of them is 9He (atomic mass number 9). a) How many protons are in a neutral 9He atom? b)  How many nucleons (that is protons and neutrons) are in a neutral 9He atom? c) How many electrons are in a neutral 9He atom? d) How many neutrons are in a neutral 9He atom?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT