Write a program that reads words from standard input and displays them to standard output. When the word "end" is read, print it out and then stop reading input.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 7E
icon
Related questions
Question
LO: (Remember) Students will recall how to read from standard input.
LO: (Apply) Students will write loops that iterate as long as a condition is true.
Write a program that reads words from standard input and displays them to standard output. When the word "end" is read, print it out and then stop reading input.
Full Screen *
maln.cpp
New
#include <iostream>
2 using namespace std;
1
3
4- /*
5
* Reads and displays words from standard input until hitting a stop word.
6
*/
7- int main() {
8
9.
10
return 0;
11
ann
Transcribed Image Text:LO: (Remember) Students will recall how to read from standard input. LO: (Apply) Students will write loops that iterate as long as a condition is true. Write a program that reads words from standard input and displays them to standard output. When the word "end" is read, print it out and then stop reading input. Full Screen * maln.cpp New #include <iostream> 2 using namespace std; 1 3 4- /* 5 * Reads and displays words from standard input until hitting a stop word. 6 */ 7- int main() { 8 9. 10 return 0; 11 ann
LO: (Apply) Students will write loops that iterate over every value in a range.
Some marathon organizers are advertising the distances of their races using kilometers. Help them explain the races to participants who are unfamiliar with the metric system. Print a line for each length of race that explains
approximately how long it is in miles.
The races are organized in increments of 5km. There is a 5km, a 10km, and so on, all the way up to a 40km race. There are approximately 0.621 miles in a kilometer. Miles should be rounded to the nearest whole number.
Follow this format:
A Skm race is approximately 3 miles long.
O New
I Full Screen ¢
maln.cpp 0
1 #include <iostream>
2 using namespace std;
4
* Displays how long each race is in kilometers and miles.
6
*/
7- int main() {
return 0;
12 }
13
Transcribed Image Text:LO: (Apply) Students will write loops that iterate over every value in a range. Some marathon organizers are advertising the distances of their races using kilometers. Help them explain the races to participants who are unfamiliar with the metric system. Print a line for each length of race that explains approximately how long it is in miles. The races are organized in increments of 5km. There is a 5km, a 10km, and so on, all the way up to a 40km race. There are approximately 0.621 miles in a kilometer. Miles should be rounded to the nearest whole number. Follow this format: A Skm race is approximately 3 miles long. O New I Full Screen ¢ maln.cpp 0 1 #include <iostream> 2 using namespace std; 4 * Displays how long each race is in kilometers and miles. 6 */ 7- int main() { return 0; 12 } 13
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr