This question is 80 complete I need one last function added
This question is 80% complete I need one last function added to my code. Any help is much appreciated I will give full thumbs up!!( I have attached my current code as well!!)!!
This is the last part I need done--->
**********************************************************
((****to add another function that allows me to search for individual student grades and highest grade by student name per student name. Using the ( (i.e. find() ) to be able to search orfind any player name. and such as the ability to find highest scores and names and scores. not sure if I\'m explaining correctly. maybe one more function to display the top three highest test grades. I have posted another question identical to this so additional credit can be given*****)
**************************************************************************************************
HERES THE ORIGNAL QUESTION BELOW
******************************************
Please comment out functions .IF anyone can help me with code, I will give thumbs up!. I\'m new to programming!!!! Unsure how to begin with a task like this.Please provide code
*********\"\"\"\"I have posted additional information needed for this program.\"\"\"\"****************
I am expecting a menu system design where I can add ( a record that consist of a person name and the test name with its highest score), Search a record , display the average score, and the other requirements/. Use functions for the add, search, and others.
From choosing from the menu, then result could be somewhat of what you are showing
The most important aspect of this assignment is to create your own functions.
Remember, functions have three parts:
1. Prototype (just like declaring a variable globally) 2. (Calling the function from within main() 3. Creating the function outside of main().
Use a menu system to display user information such as their names,three highest game names and scores.
Determine and display each players average of their scores
Use a minimum of three functions (consider one of them as an array function)
Pass value(s) to the functions using passing-by-value or passing-by-reference
Use concepts from the previous labs ( (i.e. find() ) to be able to search orfind any player name
Create a C++ executable program that creates an electronic grade sheet that can keep track of student scores during the semester.
The program should allow for the names of the students and their scores on three tests. Also, you should compute the average test score for each student. Be able to display such information at any time.
Organize the main program to call input and output functions. Use static variables to keep track of these amounts, as you will revisit a function containing the loop structure(s) for each student.
You will also need an average function that calculates all of the average test score for each student.
Note that these functions will most likely call other functions to accomplish tasks. Use value and reference parameters as necessary.
************************************************************************************
****************************************
**********************************
CUREENT WORKING CODE BELOW PLEASE ADD TO THIS CODE.. Comment any changes
#include<iostream>
using namespace std;
void calculateAverage(struct student); //function prototypes
void displayData(struct student);
struct student //student structure
{
string name;
int test1Score;
int test2Score;
int test3Score;
};
void calculateAverage(struct student a[])
{
int averageScore;
int i=0;
cout<<\"Name \\tAverage Score\ \";
while(i<5)
{
averageScore=(a[i].test1Score+a[i].test2Score+a[i].test3Score)/3; //calculate average score for each student
cout<<a[i].name<<\" \\t \"<<averageScore<<\"\ \";
i++;
}
}
void displayData(struct student a[])
{
int i=0;
cout<<\"\ Name\\tTest1 Score\\tTest2 Score\\tTest3 Score\";
while(i<5)
{
cout<<\"\ \"<<a[i].name<<\"\\t\\t\"<<a[i].test1Score<<\"\\t\\t\"<<a[i].test2Score<<\"\\t\\t\"<<a[i].test3Score;
i++;
}
}
int main()
{
int option;
struct student record[5];
string name;
int score1,score2,score3;
cout<<\"\ MENU\ \"; //main Menu
cout<<\"\ 1.Input Student records\ \";
cout<<\"\ 2.Calculate Average Score\ \";
cout<<\"\ 3.Display Student Records\ \";
cout<<\"\ 4.Exit\";
while(option !=4)
{
cout<<\"\ Enter the option\ \";
cin>>option;
switch(option)
{
case 1:
for(int i=0;i<5;i++)
{
cout<<\"Enter the name of student\ \";
cin>>name;
record[i].name=name;
cout<<\"Enter the score in test1\ \";
cin>>score1;
record[i].test1Score=score1;
cout<<\"Enter the score in test2\ \";
cin>>score2;
record[i].test2Score=score2;
cout<<\"Enter the score in test3\ \";
cin>>score3;
record[i].test3Score=score3;
}
break;
case 2: calculateAverage(record);
break;
case 3: displayData(record);
break;
case 4: break;
default: cout<<\"enter the correct option\ \";
break;
}
}
return 0;
}
Solution
I have written my own program for your problem:
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
float total_GameScore(float []);
main()
{
clrscr();
float GameScore[3][4]={0};
cout<<\"\ Enter the game score of the 3 players : \"<<endl;
for(int count_1=0;count_1<3;count_1++)
{
cout<<\"\ Enter the GameScore obtained by players \"<<count_1+1<<
\" :\"<<endl;
cout<<\"\\t GameScore_1 = \";
cin>>GameScore[count_1][0];
cout<<\"\\t GameScore_2 = \";
cin>>GameScore[count_1][1];
cout<<\"\\t GameScore_3 = \";
cin>>GameScore[count_1][2];
cout<<\"\\t GameScore_4 = \";
cin>>GameScore[count_1][3];
}
getch();
clrscr();
cout<<\"\ ********************************* Result Sheet *****************************\"<<endl;
cout<<\"\ GameScore. GameScore_1 GameScore_2 GameScore_3 GameScore_4 \";
cout<<\"Total GameScore Status\ \"<<endl;
for(int count_2=0;count_2<10;count_2++)
{
cout<<setw(8)<<count_2+1;
cout<<setw(13)<<GameScore[count_2][0];
cout<<setw(11)<<GameScore[count_2][1];
cout<<setw(11)<<GameScore[count_2][2];
cout<<setw(11)<<GameScore[count_2][3];
cout<<setw(11)<<total_GameScore(GameScore[count_2]);
cout<<setw(12)<<((total_GameScore(GameScore[count_2])>=200)?\"Win\":\"Loss\");
cout<<endl;
}
cout<<\"\ ******************************************************************************\";
getch();
return 0;
}
/*************************************************************************///----------------------- total_GameScore(float []) -----------------------///*************************************************************************/float total_GameScore(float GameScore[])
{
float sum=0;
for(int count=0;count<4;count++)
sum+=GameScore[count];
return sum;
}



