Can somebody make this program in C or C++ for me please? I have 2 hours left so I have to get it done
Write a C++ program to keep records and compute for the scores of 5 players. The information of each player contains: Nickname, Age and two best played scores.
The program will prompt the user to choose the operation of records from a menu as shown below:
==============================================
MENU
==============================================
Please find the code below::::
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <iomanip>
using namespace std;
struct Players{
string name;
int age;
double score1,score2;
};
void printMenu(){
cout<<"Enter 1 to Add record"<<endl;
cout<<"Enter 2 to View players
records"<<endl;
cout<<"Enter 3 to Compute for the
average"<<endl;
cout<<"Enter 4 to Show the player(s) who gets
the max average."<<endl;
cout<<"Enter 5 to Show the player(s) who gets
the min average."<<endl;
cout<<"Enter 6 to Open the
file."<<endl;
cout<<"Enter 7 to Close the
File"<<endl;
cout<<"Enter 8 to Exit"<<endl;
}
int main( ){
int choice;
int counts = 0;
Players players[100];
while(true){
printMenu();
cout<<"Enter your choice :
";
cin>>choice;
if(choice==1){
Players p;
cout<<"Enter name : ";
cin>>p.name;
cout<<"Enter age : ";
cin>>p.age;
cout<<"Enter best score1 : ";
cin>>p.score1;
cout<<"Enter best score2 : ";
cin>>p.score2;
players[counts]
= p;
counts++;
}else if(choice==2){
cout <<
setw(10) << left << "Name";
cout <<
setw(10) << left << "Age";
cout <<
setw(10) << left << "Score1";
cout <<
setw(10) << left << "Score2";
cout<<endl;
for(int
i=0;i<counts;i++){
cout << setw(10) << left
<<players[i].name;
cout << setw(10) << left
<<players[i].age;
cout << setw(10) << left
<<players[i].score1;
cout << setw(10) << left
<<players[i].score2;
cout<<endl;
}
}else if(choice==3){
cout <<
setw(10) << left << "Name";
cout <<
setw(10) << left << "Age";
cout <<
setw(10) << left << "Score1";
cout <<
setw(10) << left << "Score2";
cout <<
setw(10) << left << "Average";
cout<<endl;
for(int
i=0;i<counts;i++){
cout << setw(10) << left
<<players[i].name;
cout << setw(10) << left
<<players[i].age;
cout << setw(10) << left
<<players[i].score1;
cout << setw(10) << left
<<players[i].score2;
cout << setw(10) << left
<<(players[i].score1+players[i].score2)/2;
cout<<endl;
}
}else if(choice==4){
double
maxAverage=-9999;
int index =
0;
for(int
i=0;i<counts;i++){
double temp =
(players[i].score1+players[i].score2)/2;
if(temp>maxAverage){
maxAverage = temp;
index = i;
}
}
cout<<"Player with maximum average is as
below"<<endl;
cout <<
setw(10) << left << "Name";
cout <<
setw(10) << left << "Age";
cout <<
setw(10) << left << "Score1";
cout <<
setw(10) << left << "Score2";
cout <<
setw(10) << left << "Average";
cout<<endl;
cout <<
setw(10) << left <<players[index].name;
cout <<
setw(10) << left <<players[index].age;
cout <<
setw(10) << left <<players[index].score1;
cout <<
setw(10) << left <<players[index].score2;
cout <<
setw(10) << left
<<(players[index].score1+players[index].score2)/2;
cout<<endl;
}else if(choice==5){
double
minAverage=9999;
int index =
0;
for(int
i=0;i<counts;i++){
double temp =
(players[i].score1+players[i].score2)/2;
if(temp<minAverage){
minAverage = temp;
index = i;
}
}
cout<<"Player with minimum average is as
below"<<endl;
cout <<
setw(10) << left << "Name";
cout <<
setw(10) << left << "Age";
cout <<
setw(10) << left << "Score1";
cout <<
setw(10) << left << "Score2";
cout <<
setw(10) << left << "Average";
cout<<endl;
cout <<
setw(10) << left <<players[index].name;
cout <<
setw(10) << left <<players[index].age;
cout <<
setw(10) << left <<players[index].score1;
cout <<
setw(10) << left <<players[index].score2;
cout <<
setw(10) << left
<<(players[index].score1+players[index].score2)/2;
cout<<endl;
}else if(choice==6){
cout<<"Enter file name : ";
string
fileName;
cin>>fileName;
ifstream
infile;
string
line;//for read line
cout<<"Loading the file........"<<endl;
infile.open
(fileName); //name of file here. plz mention Complete path if file
is not at root
if
(infile.is_open()) //if file opened
{
while( getline(infile, line,'\n') ) { //get row
from text file
stringstream ss(line);
//stream to other variable
Players p;
ss>>p.name;
ss>>p.age;
ss>>p.score1;
ss>>p.score2;
players[counts] = p;
counts++;
}
infile.close(); //close file
cout<<"File
loaded........"<<endl;
}
else //if file
not found show the below message
{
cout << "Sorry, we could not find the
file." << endl;
}
}else if(choice==7){
cout<<"Enter output file name : ";
string
fileName;
cin>>fileName;
ifstream
infile;
string
line;//for read line
cout<<"Loading the file........"<<endl;
ofstream myfile
(fileName);
for(int
i=0;i<counts;i++){
myfile <<players[i].name<<" ";
myfile <<players[i].age<<" ";
myfile <<players[i].score1<<"
";
myfile <<players[i].score2<<"
";
myfile<<endl;
}
cout<<"Data exported successfully..."<<endl;
}else if(choice==8){
break;
}else{
cout<<"Please enter correct choice"<<endl;
}
cout<<endl;
}
}
output:
Can somebody make this program in C or C++ for me please? I have 2 hours...
Write a C++ program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score. The program will prompt the user to choose the operation of records from a menu as shown below: ============================================== MENU =============================================== 1. Add student records 2. Delete student records 3. Update student records 4. View all student records 5. Calculate...
C++ I need to make a program to help keep score. The program should first ask for the number of players in the game and the number of rounds to be played. Based on the number of players, the program should then ask for the names of the players and write them to a file. If no file exists, the program should create one. For each of the rounds, the program should accept the scores for each of the players....
In this project, you will use functions and dictionaries to track basketball players and their respective points, then display statistics of points made. You will need three functions as follows: def freeThrowMade(playerDictionary, playerName) - this function will add 1 point to the player's total score def twoPointMade(playerDictionary, playerName) - this function will add 2 points to the player's total score def threePointMade(playerDictionary, playerName) - this function will add 3 points to the player's total score Each of these functions has...
java Part 1 Create a NetBeans project that asks for a file name. The file should contain an unknown quantity of double numeric values with each number on its own line. There should be no empty lines. Open the file and read the numbers. Print the sum, average, and the count of the numbers. Be sure to label the outputs very clearly. Read the file values as Strings and use Double.parseDouble() to convert them. Part 2 Create a NetBeans project...
PLEASE INCLUDE SAW-PROMPTS FOR 2 PLAYERS NAMES(VALIDATE NAMES). SHOW MENU (PLAYER MUST SELECT FROM MENU B4 THE GAME STARTS 1=PLAY GAME, 2=SHOW GAME RULES, 3=SHOW PLAYER STATISTICS, AND 4=EXIT GAME WITH A GOODBYE MESSAGE.) PLAYERS NEED OPTION TO SHOW STATS(IN A DIFFERNT WINDOW-FOR OPTION 3)-GAME SHOULD BE rock, paper, scissor and SAW!! PLEASE USE A JAVA GRAPHICAL USER INTERFACE. MUST HAVE ROCK, PAPER, SCISSORS, AND SAW PLEASE This project requires students to create a design for a “Rock, Paper, Scissors,...
In C Program This program will store the roster and rating information for a soccer team. There will be 3 pieces of information about each player: Name: string, 1-100 characters (nickname or first name only, NO SPACES) Jersey Number: integer, 1-99 (these must be unique) Rating: double, 0.0-100.0 You must create a struct called "playData" to hold all the information defined above for a single player. You must use an array of your structs to to store this information. You...
Use C++ 11 to write the program War Game Requirement Setting This is a 2-player game. It is played through dice. Rule for scoring The player who rolls higher number gets one point. If both players roll the same number, it is considered a draw and no one gets a point. Dice Specification There are two kinds of dice: normal die, represented by Die class. loaded die, represented by the loadedDie class. Classes Die class Die class has a member...
c++ CSI Lab 6 This program is to be written to accomplish same objectives, as did the program Except this time we modularize our program by writing functions, instead of writing the entire code in main. The program must have the following functions (names and purposes given below). Fot o tentoutefill datere nedefremfite You will have to decide as to what arguments must be passed to the functions and whether such passing must be by value or by reference or...
I need to create a Tic Tac Toe program in C++. These are the requirements Write a program that allows the computer to play TicTacToe against a human player or allow two human players to play one another. Implement the following conditions: The player that wins the current game goes first in the next round, and their symbol is X. The other player will be O. Keep track of the number of games played, wins, and draws for each player....
I need to update this C++ code according to these instructions.
The team name should be "Scooterbacks".
I appreciate any help!
Here is my code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void menu();
int loadFile(string file,string names[],int jNo[],string
pos[],int scores[]);
string lowestScorer(string names[],int scores[],int size);
string highestScorer(string names[],int scores[],int size);
void searchByName(string names[],int jNo[],string pos[],int
scores[],int size);
int totalPoints(int scores[],int size);
void sortByName(string names[],int jNo[],string pos[],int
scores[],int size);
void displayToScreen(string names[],int jNo[],string pos[],int
scores[],int size);
void writeToFile(string...