Concept explainers
Rewrite the following
int selection;
cout << "Which formula do you want to see?\n\n";
cout << "1. Area of a circle\n";
cout << "2. Area of a rectangle\n";
cout << "3. Area of a cylinder\n"
cout << "4. None of them!\n";
cin >> selection;
1f (selection == 1)
cout << "Pi times radius squared\n";
else if (selection == 2)
cout << "Length times width\n";
else if (selection == 3)
cout << "Pi times radius squared times height\n";
else if (selection == 4)
cout << "Well okay then, good-bye!\n";
else
cout << "Not good with numbers, eh?\n";
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Starting Out with C++: Early Objects
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Python (4th Edition)
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
SURVEY OF OPERATING SYSTEMS
Starting Out With Visual Basic (8th Edition)
Electric Circuits. (11th Edition)
- Slide Type Slide Exercise # 3: Write a program that first asks the user to type today's price for one dollar in Japanese yen, then reads US dollar values and converts each to yen. Use 0 as a sentinel. • The following are sample runs of the program. Slide Type Enter today's price in yens for 1 $: 105.69 Enter amount in dollars to convert: (0 to quit) 200 200.00 dollars = 21138.00 yens Enter amount in dollars to convert: (0 to quit) 500 500.00 dollars = 52845.00 yens Enter amount in dollars to convert: (0 to quit) 100 100.00 dollars = 10569.00 yens Enter amount in dollars to convert: (0 to quit) e Slide Type Enter today's price in yens for 1 $: 105.6 Enter amount in dollars to convert: (0 to quit) e Slide Type # Exercises # 3 Source Codearrow_forwardExercise II Write a program that finds the positive integer solutions of the following equation ax³ + bx² + cx' + d = 0. The user enters the values of coefficients a, b, c and d. The program should test each integer starting from -50 to 50, and each time the equation is equal to zero, it prints its value as well as "is a solution". At the end, it displays the total number of positive integers found. Note that if the equation has more than one solution, the plural word “solutions" is used in the output. Sample run 1: Enter the coefficient of a, b, c, d: 1 -8.5 21 -13.5 1 is a solution 3 is a solution The equation has 2 integers as solutions Sample run 2: Enter the coefficient of a, b, c, d: 6 48 103.5 67.5 The equation has no integer solutions Sample run 3: Enter the coefficient of a, b, c, d: 1 -1 -12 0 4 is a solution The equation has 1 integer solutionarrow_forwardQuestion # 4: Write a program that calculates the electricity bill. The rates of electricity per unit are as follows: If the units consumed are 300 and 8 2000 2750 Question # 6: Write a program that converts the angle from degree to radian and displays each value.arrow_forward
- Q1. FizzBuzz problem:- Write a program which return "fizz" if the number is a multiplier of 3, return "buzz" if its multiplier of 5 and return "fizzbuzz" if the number is divisible by both 3 and 5. If the number is not divisible by either 3 or 5 then it should just return the number itself? .arrow_forward1_ Write a program that reads a character and prints it only if it is 'y' or 'Y' (Simulation of If-Else then structure). 2_Write a program that prints the odd numbers between 1 and 10 using loop (Number 1 ASCII code is 49).arrow_forwardDraw the Boolean expressionarrow_forward
- Area and Perimeter: Write a program that prints the area and perimeter of a circle with a radius of 5.5 using the formula: Perimeter = 2 * radius * PI Area radius * radius * PI Use Math.PI for PI in your program.arrow_forwardDraw the Boolean expression: *arrow_forwardTrue/False 5. Keywords make good variable names.arrow_forward
- Vary the control variable from 1 to 100 in increments of 1 .for (unsigned int i{1}; i <= 100; i++)arrow_forwardcorrect all errors.arrow_forward1. Write a program that lets the user guess whether a randomly generated integer would be even or odd. The program randomly generates an integer and divides it by 2. The integer is even if the remainder is 0, otherwise odd. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect.arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning