Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a C++ program that prompts the users to enter test scores. The program co

ID: 3926002 • Letter: C

Question

Create a C++ program that prompts the users to enter test scores. The program continue until user enter -1 to stop the program. The program then displays: the number of the tests entered, the total of the test points, and the average of the test scores. Create a C++ program that write 4 of your classmates' name to a file named "friends.txt". First, Open an output file - "friends.txt", get the names of 4 friends, then write the names to the file. Close the file. Create a C++ program that prompt the user to enter his/her first name. Then the program asks the user to enter his/her last name. The program then display the full name of this person. Create a C++ program that simulate rolling a die 100 times. The program displays the tally of the how many times for each number. For example: 16 times 20 times

Explanation / Answer

#include <iostream>
using namespace std;
int main()
{
   int temp;
   int count=0;
   int sum=0;
   while(true)
   {
       cout<<"Enter a test score(-1 to quit):";
       cin>>temp;
       if(temp==-1){break;}
       sum = sum+temp;
       count++;
   }
   cout<<"The number of test scores is "<<count<<endl;
   cout<<"The sum of all test scores is "<<sum<<endl;
   cout<<"The average of all test scores is "<<(sum*1.0)/count<<endl;

   return 0;
}