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)?
Write a C program that accepts a port number as a command line argument, and starts...
Write a C program that accepts a port number as a command line argument, and starts an HTTP server. This server should constantly accept() connections, read requests of the form: GET /path HTTP/1.1\r\n\r\n read the file indicated by /path, and send it over the "connect" file descriptor returned by the call to accept().
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 distribution of the number of people in line at a grocery store has a mean...
The distribution of the number of people in line at a grocery store has a mean of 3 and a variance of 9. A sample of the numbers of people in line in 50 stores is taken. (a) Calculate the probability that the sample mean is more than 4? Round values to four decimal places. (b) Calculate the probability the sample mean is less than 2.5. Round answers to four decimal places. (c) Calculate the probability that the the sample...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT