Question
Description (This challenge has to be created using c++ code). The purpose of this challenge is to use the WHILE loop to control program flow.
Description (This challenge has to be created using c++ code).
The purpose of this challenge is to use the WHILE loop to control program flow. This challenge will use the WHILE loop in various ways.
Requirements
Write all your code for the following steps in one file.
Ask the user to enter a single string. Ask the user to enter an integer value for a variable called repetitions. Use a while loop to display this string (of your choice) repeated repetitions times, one string per line
Use a while loop to count and display all the integers from 1 to 20. Separate numbers with a space
Use a while loop to display all numbers divisible by 10 starting from 100 down to 0. Only show numbers divisible by 10. Separate numbers with a tab. TAB character is displayed using the \t escape sequence. (Remember that is a newline; use similarly)
Use a while loop to keep asking the user for an integer as long as positive numbers are being entered. For every positive number entered, show its value multiplied by 2. Once a negative number is entered stop asking and quit the loop
Use a while loop to keep asking for a string until a particular string is entered (for example, bye)
Do Not Use
You must use the WHILE statement. You may not use any other looping mechanism.
THIS IS HOW IS SUPPOSE TO LOOK AFTER THE PROGRAM HAS BEEN RUN.
Enter a string to be repeated: coffee How many times to show? 5 coffee coffee coffee coffee coffee 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 100 90 80 70 60 50 40 30 20 10 Enter a number: 3 3 x 2 = 6 Enter a number: 7 7 x 2 = 14 Enter a number: -2 Enter a string: yo Enter a string: hi Enter a string: hola Enter a string: sup Enter a string: bye
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started