sport management project with classes in main
#include<iostream>
#include<fstream>
#include<string>
#include<stdlib.h>
#include<conio.h>
using namespace std;
class Player{
private:
int playerid;
string playerName;
int age;
char add[30];
long long phno;
string parentName;
char game[30];
string coachName;
int dorm;
int bed;
public:
void input(){
cout<<"\nEnter player id no: ";
cin>>playerid;
cout<<"\nEnter player age: ";
cin>>age;
string strFname="", strLname="";
cout<<"\nEnter the First Name of Player: ";
cin>>strFname;
cout<<"\nEnter the Last Name of Player: ";
cin>>strLname;
playerName = strFname +" "+ strLname;//Stores the Player as Fname_Lname ex. Aastha_Anand
cout<<"\nEnter player address(City): ";
cin>>add;
cout<<"\nEnter player phone no.: ";
cin>>phno;
cout<<"\nEnter the First Name of Player's Parent: ";
cin>>strFname;
cout<<"\nEnter the Last Name of Player's Parent: ";
cin>>strLname;
parentName = strFname +" "+ strLname;//Stores the Player as Fname_Lname ex. Aastha_Anand
cout<<"\nEnter game name 'Basketball', 'TableTennis', 'Cricket', 'Volleyball', 'Hockey', 'Taekwondo', 'Badminton'\nGame Name: ";
cin>>game;
cout<<"\nEnter the First Name of Coach: ";
cin>>strFname;
cout<<"\nEnter the Last Name of Coach: ";
cin>>strLname;
coachName = strFname +" "+ strLname;
cout<<"\nEnter dorm no.: ";
cin>>dorm;
cout<<"\nEnter bed no.: ";
cin>>bed;
}
void output(){
cout<<"\nPlayer Details: \n";
cout<<"playerid==>"<<playerid<<endl;
cout<<"player name==>"<<playerName<<endl;
cout<<"player add==>"<<add<<endl;
cout<<"phone no==>"<<phno<<endl;
cout<<"parent name==>"<<parentName<<endl;
cout<<"game prefered==>"<<game<<endl;
cout<<"coach alloted==>"<<coachName<<endl;
cout<<"dorm no==>"<<dorm<<endl;
cout<<"bed no==>"<<bed<<endl;
}
string retplayername(){
return playerName;
}
int retplayerid(){
return playerid;
}
int retage(){
return age;
}
char* radd(){
return add;
}
long long rphno(){
return phno;
}
string rparentn(){
return parentName;
}
char* rgame(){
return game;
}
string rcoachn(){
return coachName;
}
int rdorm(){
return dorm;
}
int rbed(){
return bed;
}
};
int main(){
Player player;
while(1){
int choice;
cout<<"\n\n=============== SPORTS MANAGEMENT SYSTEM ===================";
cout<<"\n1: Add a new Player Record";
cout<<"\n2: Show all Players Record";
cout<<"\n3: Delete Player by its Player Id from Record";
cout<<"\n4: Delete Player by its Player Name from Record";
cout<<"\n5: Search Player using Player Name";
cout<<"\n6: Search Player using Player Id";
cout<<"\n7: Search Player using Dorm No.";
cout<<"\n8: Search Player using Bed No.";
cout<<"\n9: Search Players using Parents Name";
cout<<"\n10: Search Players in a specific Game";
cout<<"\n11: Count the No. of Player in all Games";
cout<<"\n12: Count the Total no. of Player's Record";
cout<<"\n13: Clear the complete database of Player's Record";
cout<<"\n14: Exit from Program";
cout<<"\n\nEnter your choice...!\n";
cin>>choice;
system("cls");
player.input();
player.output();
}
}
Comments
Leave a comment