(Solved) : Outer Blank Lesson 5a Lab 51 Working Loop Bring Program Cpp Lab 5 Folder Sample Program 52 Q41389447 . . .

outer for each blank.) LESSON 5A LAB 5.1 Working with the while Loop Bring in program while.cpp from the Lab 5 folder. (This66 LESSON SET 5 Loops and Files Exercise 1: This program is not user friendly. Run it a few times and explain why. Exercise 2

I only need exercise 2, please!

outer for each blank.) LESSON 5A LAB 5.1 Working with the while Loop Bring in program while.cpp from the Lab 5 folder. (This is Sample Program 5.2 from the Pre-lab Reading Assignment). The code is shown below: 1/ PLACE YOUR NAME HERE #include <iostream> using namespace std; int main() char letter = ‘a’; while (letter != ‘x’) cout << “Please enter a letter” << endl; cin >> letter; cout << “The letter you entered is ” << letter << endl; return 0; 66 LESSON SET 5 Loops and Files Exercise 1: This program is not user friendly. Run it a few times and explain why. Exercise 2: Add to the code so that the program is more user friendly. Exercise 3: How would this code affect the execution of the program if the while loop is replaced by a do-while loop? Try it and see. Bring in program sentinel.cpp from the Lab 5 Folder. The code is shown below: // This program illustrates the use of a sentinel in a while loop. // The user is asked for monthly rainfall totala until a sentinel // value of -1 is entered. Then the total rainfall is displayed. // PLACE YOUR NAME HERE Hinclude <iostream> using namespace std; int main() // Fill in the code to define and initialize to 1 the variable month float total – 0, rain; cout << “Enter the total rainfall for month ” << month << endl; cout << “Enter -1 when you are finished” << endl; // Fill in the code to read in the value for rain // Fill in the code to start a while loop that iterates // while rain does not equal -1 // Fill in the code to update total by adding it to rain // Fill in the code to increment month by one cout << “Enter the total rainfall in inches for month << month << endl; cout << “Enter -1 when you are finished” << endl; // Fill in the code to read in the value for rain if (month — 1) cout << “No data has been entered” << endl; else cout << “The total rainfall for the ” << month-1 << ” months is “<< total << ” inches.” << endl; return 0; Show transcribed image text outer for each blank.) LESSON 5A LAB 5.1 Working with the while Loop Bring in program while.cpp from the Lab 5 folder. (This is Sample Program 5.2 from the Pre-lab Reading Assignment). The code is shown below: 1/ PLACE YOUR NAME HERE #include using namespace std; int main() char letter = ‘a’; while (letter != ‘x’) cout

Expert Answer


Answer to outer for each blank.) LESSON 5A LAB 5.1 Working with the while Loop Bring in program while.cpp from the Lab 5 folder. (…