I HAVE AN ASSIGNEMENT IN WHICH I GET STUDENT DATA AND SAVE IT A SEPARATE TEXT FILE , THE MAIN PROBLEM IS THAT IT TAKE ALL THE VALUES BUT DONOT STORE VALUE OF SEM,ADD-NO AND BATCH . KINDLY PLEASE HELP ME .
Coding is :-
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
struct stud
{
char *name;
int roll;
float gpa;
char *sem;
char *batch;
char *add;
float cgpa;
};
int main()
{
clrscr();
fstream p("\\DATA.TXT",ios::out);
int check;
struct stud s;
while(check!=4)
{
clrscr();
cout<<"\n\n\t\tWELLCOME TO DATABASE FOR STUDENTS(SEMESTER SYSTEM)";
cout<<"\n\n\t\t\t PRESS 1 FOR ENTERING DATABASE";
cout<<"\n\n\t\t\t PRESS 2 FOR VIEWING DATABASE";
cout<<"\n\n\t\t\t PRESS 3 FOR DELETING DATABASE";
cout<<"\n\n\t\t\t PRESS 4 TO EXIT";
cout<<"\n\n\n\n\t\t\tENTER YOUR OPTION : ";
cin>>check;
if(check==1)
{
clrscr();
cout<<"\n\nENTER STUDENT NAME : ";
cout<<"\n\n********************************";
cout<<"\n\nENTER ROLL NUMBER : ";
cout<<"\n\n********************************";
cout<<"\n\nENTER GPA : ";
cout<<"\n\n********************************";
cout<<"\n\nENTER YOUR SEMESTER : ";
cout<<"\n\n********************************";
cout<<"\n\nENTER YOUR BATCH : ";
cout<<"\n\n********************************";
cout<<"\n\nENTER YOUR AD-NO : ";
cout<<"\n\n********************************";
cout<<"\n\nENTER YOUR CGPA : ";
cout<<"\n\n********************************";
gotoxy(21,3);
cin>>s.name;
gotoxy(21,7);
cin>>s.roll;
gotoxy(12,11);
cin>>s.gpa;
gotoxy(22,15);
cin>>s.sem;
gotoxy(19,19);
cin>>s.batch;
gotoxy(19,23);
cin>>s.add;
gotoxy(18,27);
cin>>s.cgpa;
//EOS for end of entry and EOL for end of line
p<<s.name<<"(EOS)"<<s.roll<<"(EOS)"<<s.gpa<<"(EOS)"<<s.sem<<"(EOS)"<<s.batch<<"(EOS)"<<s.add<<"(EOS)"<<s.cgpa<<"(EOF)";
}
}
return 0;
}