Simple game database

Simple Game Database

Solution 

#include<iostream>

using namespace std;

struct game{

stringgameTitles[10];

intgraphicScores[10];

intreplayValue[10];

}game1;

voidenterGameInfo()

{

for(int i =0; i<10; i++)

{

cout<<“\nEnter game title: “;

cin>>game1.gameTitles[i];

}

}

voidenterGraphicInfo()

{

for(int i =0; i<10; i++)

{

cout<<“\nEnter the graphic score for the game title “<<game1.gameTitles[i]<<” :”;

cin>>game1.graphicScores[i];

}

}

voidenterReplayInfo()

{

for(int i =0; i<10; i++)

{

cout<<“\nEnter the replay value of the game title “<<game1.gameTitles[i]<<“:”;

cin>>game1.replayValue[i];

}

}

voidgetHighestGraphics()

{

int max = game1.graphicScores[0];

int temp =0;

for(int i =1; i<10; i++)

{

if(game1.graphicScores[i]>max)

{

max = game1.graphicScores[i];

temp =i;

}

}

cout<<“\nThe highest rated graphics game is “<<game1.gameTitles[temp]<<” with a score of “<<max;

}

voidgetHighestReplay()

{

int max = game1.replayValue[0];

int temp =0;

for(int i =1; i<10; i++)

{

if(game1.replayValue[i]>max)

{

max = game1.replayValue[i];

temp =i;

}

}

cout<<“\nThe highest rated replay game is “<<game1.gameTitles[temp]<<” with a score of “<<max;

}

voidgetHighestCombined()

{

int max = -1;

int index = -1;

int combined[10];

for(int i =0; i<10; i++)

{

combined[i] = game1.graphicScores[i] + game1.replayValue[i];

if(combined[i]>max)

{

max = combined[i];

index = i;

}

}

cout<<“\nThe highest rated combined score game is “<<game1.gameTitles[index]<<” with a score of “<<max;

}

int main()

{

enterGameInfo();

enterGraphicInfo();

enterReplayInfo();

getHighestGraphics();

getHighestReplay();

getHighestCombined();

return 0;

}