You are on page 1of 2

#include<iostream>

#include<string>
using namespace std;

class student{
private:
string name;
int std;
string club;
string city;

// static int count;


public:
student(){
name = "****";
std = 0;
club = "****";
city = "****";

student(string name, int std, string club, string city){


this->name = name;
this->std = std;
this->club = club;
this->city = city;
}

~student(){};

void accept(){
cout<<"enter your name: ";
cin>>name;
cout<<"enter your standard: ";
cin>>std;
cout<<"enter your club: ";
cin>>club;
cout<<"enter your city: ";
cin>>city;
//student* s1 = new student(name, std, club, city);
cout<<endl;
}

void display(){
student* s = new student(name, std, club, city);
cout<<"name\t\tstandard\t\tclub\t\tcity";
cout<<endl;
cout<<s->name<<"\t\t"<<s->std<<"\t\t"<<s->club<<"\t\t"<<s->city;
}
};

int main()
{
student* s = new student();
char choice;
do{
int selection;
cout<<"\t\t\tmenu"<<endl;
cout<<"enter 1 to enter data"<<endl;
cout<<"enter 2 to display"<<endl;
cout<<"enter 3 to see number of children"<<endl;
cout<<"enter 4 to exit"<<endl;
cout<<"enter your choice: ";
cin>>selection;
switch(selection){
case 1:{
s->accept();
break;
}
case 2:{
s->display();
break;
}
case 3:{

break;
}
case 4:{
break;
}
default:
cout<<"enter valid choice"<<endl;
}
cout<<"\ndo you want to continue(y/n): ";
cin>>choice;
}while(choice=='y');

return 0;
}

You might also like