Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

those are 3 quistions if u can write the title just to know which homework it is? wk4 whileSum Write a program that will compute

those are 3 quistions if u can write the title just to know which homework it is?
image text in transcribed
image text in transcribed
image text in transcribed
wk4 whileSum Write a program that will compute and display the sum of a number of integers chosen by the user. The program should ask the user how many numbers will be entered and input that number. Then a counter-controlled "while" loop will ask the user to enter a number. The loop will execute as many times as the user had indicated. Each time the loop executes and receives a number to be added, that value will be added onto a running total. Output will show the total of the numbers input by the user. SAMPLE RUNS How many numbers do you want to sum? 4 Enter a value: 1 Enter a value: 2 Enter a value: 3 Enter a value: 4 The sum of those numbers is 10 Process returned @ (exe) Press any key to continue. execution time : 5.876 s How many numbers do you want to sum? 5 Enter a value: 0 Enter a value: -1 Enter a value: -2 Enter a value: 5 Enter a value: 123 The sum of those numbers is 125 Process returned @ (exe) execution time : 13.705 s Press any key to continue. wk4 doWhileInput Write a program that prints a message as many times as the user chooses. The program will prompt the user to input a message. The message will be printed to the screen, then the user will be asked if it is to be displayed again. If the user answers y or 'Y, the message will appear again Any other value input will cause the loop to end and the program to end after a brief Byel). Three should be variables to hold the message (a string) and a character to hold the letter entered by the user to indicate whether or not to show the message again You MUST use a do...while loop in this program. SAMPLE RUN What message shall I print? C++ is fun! C++ is fun! Shall I show that again? (y) y C++ is fun! Shall I show that again? (y) y C++ is fun! Shall I show that again? (y) n Bye. Process returned @ (exe) Press any key to continue. execution time : 11.233 S Wk4 - Homework Program - Patterns Write a program that uses "for" loops to create the output indicated in the output screenshot below. Each line of the output is created by a different loop. The first for"loop will simply use the counter variable to repeat output 7 times, The second "for loop will include an if...else structure to choose whether to print the 'E or the 'O, depending on whether the counter variable is even or odd. (HINT: Use the modulus operator to do this.) The third for loop will include a switch structure that has a case for each value the counter variable will have. Be sure you let the cases all through when appropriate. SAMPLE RUN & A ! execution time: 0.141 s Process returned @ (exe) Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions