Create a statistics program in C++ for sports (which ever sport you'd prefer).
The program must use at least one menu at the beginning with
multiple options including an option to exit the program.
The program must run continuously, in a cyclic manner until the
user chooses to exit.
Sublevel menus are allowed.
The program must use: multiple data types, multiple mathematical
operators, decision structures, iterative structures, and
functions.
The program should be thoroughly documented with introductory
comments at the top and other comments in areas that could be
confusing.
The program should be easily readable and use proper indention.
#include <iostream>
using namespace std;
int main() {
//Delcaring Variable Option_Input to take input from user
int Option_Input=1;
//Boolean variable to exit while loop
int exit=0;
//variable to take name of players
char FirstPlayerName[30];
char SecondPlayerName[30];
//variable to take number of games
int NumberOfGames;
int count = 0;
//player one results
int PlayerOneResults;
int PlayerOneTotal=0;
//player 2 results
int PlayerTwoResults;
int PlayerTwoTotal=0;
//Diplaying Welcome messgae
cout << "Welcome to Tennis game\n";
cout<<"---------------------------";
//While to rerun program untill user choose to exit
while(Option_Input==1){
cout<<"\nPlease select option :\n1.Start Game\n2.Quit --->";
//User input will be stored in Option_Input
cin>>Option_Input;
//if user select opton 2 then program will get end
if(Option_Input==2){
break;
}
//if user choose option 1 below items will occur
else if(Option_Input==1){
/*Taking 1st player name and 2nd player names*/
cout<<"\tMaximum number players is two.\n\t---------------------------\n\tPlease enter name of 1st Player: ";
cin>>FirstPlayerName;
cout<<"\tPlease enter name of 2nd Player: ";
cin>>SecondPlayerName;
/* Below are some rules related to game*/
cout<<"\n\n\t\t Below are values need to enter to identify winner of game.\n\t\t1.Represents winner\n\t\t2.Represents Loser.\n\t\t(Note: If you enter 1 or 0 for both players then its a draw.)\n\n";
cout<<"\t\t\tPlease enter how many number of games you want play:";
cin>>NumberOfGames;
//for loop to take values of each player based on NumberOfGames
for(int i=1;i<=NumberOfGames;i++){
cout<<"\t\t\t"<<i<<" Game. Enter 1 if "<<FirstPlayerName<<" wins.Else enter 0 : ";
cin>>PlayerOneResults;
//calculating total number of wins by 1st player
PlayerOneTotal=PlayerOneTotal+PlayerOneResults;
cout<<"\t\t\t"<<i<<" Game. Enter 1 if "<<SecondPlayerName<<" wins.Else enter 0 : ";
cin>>PlayerTwoResults;
//calculating total number of wins by 2nd player
PlayerTwoTotal=PlayerTwoTotal+PlayerTwoResults;
}
cout<<"\n\n\n___________________________\n";
//Displaying output based on score of players
if(PlayerOneTotal>PlayerTwoTotal){
cout<<FirstPlayerName<<" wins.";
}
else if(PlayerOneTotal<PlayerTwoTotal){
cout<<SecondPlayerName<<" wins.";
}
else{
cout<<"It's a draw.";
}
}
else if(Option_Input==2){
exit=1;
}
cout<<"\n___________________________\n";
}
}
Create a statistics program in C++ for sports (which ever sport you'd prefer). The program must...
C LANGUAGE. PLEASE INCLUDE COMMENTS :)
>>>>TheCafe V2.c<<<<
#include <stdio.h>
int main()
{
int fries; // A flag denoting whether they want fries or not.
char bacon; // A character for storing their bacon preference.
double cost = 0.0; // The total cost of their meal, initialized to start at 0.0
int choice; // A variable new to version 2, choice is an int that will store the
// user's menu choice. It will also serve as our loop control...