hi i need help with my project. i want the following information to be written on file but i cant understand how to.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
[int doctordetail;
cout<<"\t*************** Doctor Details *****************\n\n\n";
cout<<"1. Add New Doctor\n\n2. View Doctor Details.\n\n";
cin>>doctordetail;
system ("cls");
switch(doctordetail){
case 1:
char name[50],field[50];
int num,age;
cin.sync();
cout<<"\nEnter The Doctor Name = ";
cin.getline(name,50);
cout<<"\nEnter the Doctors Field = ";
cin.getline(field,50);
cout<<"\nEnter Age = ";
cin>>age;
cout<<"\nEnter Experience(in years) = ";
cin>>num;
cout<<"\nName = "<<name;
cout<<"\nAge = "<<age;
cout<<"\nExperience = "<<num;
cout<<"\nField = "<<field;
ofstream out("doctordetails.txt",ios::app|ios::binary);
out.write((char*)(int*));
out.close();
cout<<"Your Entry Has been saved ";
break;
}]
|
Last edited on