Problem Statement:
Writing and Reading student data in a file.
Detailed Description:
Write a program in which you have to:
1) Create a text file "Student_info".
2) Using Code Write the following data in it:
Roll NO Student Name Class
101 Ali Raza BS(CS)
102 Usman MS(CS)
103 Faizan BS(CS)
104 Rehan MIT
105 Ahmed MCS
3) Open file and read data from it and display on the screen.
Sample Output
Student Information
Roll NO Student Name Class
101 Ali Raza BS(CS)
102 Usman MS(CS)
103 Faizan BS(CS)
104 Rehan MIT
105 Ahmed MCS
Deadline
Your assignment must be uploaded/submitted on or before 18-06-2009.
For this I have developed following code. Plz correct it. I need it by 18th June 2009.
#include<iostream.h>
#include<fstream.h>
main()
char student_info, stname, clas;
int rno;
{
char student_info[];
int rno[10];
char stname[50];
char clas[30];
ifstream inFile;
char inputFileName[]=student_info.txt;
inFile.open(inputFileName);
if(!inFile)
{
cout<<"Cannot open input file named" <<inputFileName<<endl;
exit(1);
}
while(!inFile.eof())
{
inFile>>rno>>stname>>clas;
cout<< Roll No <<"\t"<<Student Name<<"\t"<<Class<<endl
inFile.close()
}
}