Cout head3 byten endl numbercounter next number end

This preview shows page 8 - 13 out of 14 pages.

cout << head3 << byTen << endl;numberCounter++; // Next number} // End of while loop// This is the work done in the endOfJob() functionreturn 0;} // End of main()
4, 2018[ASSIGNMENT #5] Place your name hereLab 5-2#include "stdafx.h"// MovieGuide.cpp - This program allows each theater patron to enter a value from 0 to 4 // indicating the number of stars that the patron awards to the Guide's featured movie of the // week. The program executes continuously until the theater manager enters a negative number to // quit. At the end of the program, the average star rating for the movie is displayed. #include <iostream>#include <string>using namespace std;int main(){// Declare and initialize variables.double numStars; // star rating.double averageStars; // average star rating.double totalStars = 0; // total of star ratings.int numPatrons = 0; // keep track of number of patron// This is the work done in the housekeeping() funct
4, 2018[ASSIGNMENT #5] Place your name here// Get input.cout << "Enter rating for featured movie: ";cin >> numStars;// This is the work done in the detailLoop() functionwhile (numStars >= 0) // Test for loop entry.{totalStars += numStars; // Accumulate total of star ratings.numPatrons++; // Add 1 to number of patrons.cout << "Enter rating for featured movie: ";cin >> numStars;} // End of while loop.// This is the work done in the endOfJob() functionaverageStars = totalStars / numPatrons;cout << "Average Star Value: " << averageStars << endl;return 0;} // End of main() Lab 5-3#include "stdafx.h"// NewMultiply.cpp - This program prints the numbers 0 through 10 along// with these values multiplied by 2 and by 10.// Input: None// Output: Prints the numbers 0 through 10 along with their values multiplied by 2 and by 10. #include <iostream>#include <string>using namespace std;
4, 2018[ASSIGNMENT #5] Place your name hereint main(){string head1 = "Number: ";string head2 = "Multiplied by 2: ";string head3 = "Multiplied by 10: ";int numberCounter; // Numbers 0 through 10int byTen;// Stores the number multiplied by 10int byTwo; // Stores the number multiplied by 2const int NUM_LOOPS = 10; // Constant used to control loop// This is the work done in the housekeeping() functioncout << "0 through 10 multiplied by 2 and by 10." << endl;// This is the work done in the detailLoop() functionfor (numberCounter = 0; numberCounter <= NUM_LOOPS; numberCounter++){byTen = numberCounter * 10; // Calculate value multiplied by 10byTwo = numberCounter * 2; // Calculate value multiplied by 2cout << head1 << numberCounter << endl;cout << head2 << byTwo << endl;cout << head3 << byTen << endl;} // End of for loop// This is the work done in the endOfJob() functionreturn 0;} // End of main()
4, 2018[ASSIGNMENT #5] Place your name hereLab 5-4#include "stdafx.h"// NewestMultiply.cpp - This program prints the numbers 0 through 10 along// with these values multiplied by 2 and by 10.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture