Create a C++ program that prompts the users to enter test scores. The program co
ID: 3926041 • 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.Explanation / Answer
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ofstream mf;
mf.open ("friends.txt");
string s;
cout<<"Enter the name of you first friend:";
getline(cin,s);
mf<<s<<endl;
cout<<"Enter the name of you second friend:";
getline(cin,s);
mf<<s<<endl;
cout<<"Enter the name of you third friend:";
getline(cin,s);
mf<<s<<endl;
cout<<"Enter the name of you fourth friend:";
getline(cin,s);
mf<<s<<endl;
mf.close();
}