if plz anyone can help me through this . i have to read a particular student data from file using his Roll no and modify it and then save it to file again
Plz help me through
This is the File
24 salman 98 97 96 95 94 A ;
21 faizan 88 87 86 83 85 B ;
35 Gohar 99 98 97 96 90 B ;
45 sibghat 91 92 78 85 88 C ;
009 john 89 87 91 78 95 C ;
how can i read data of roll no 35 and modify it and save it again to the file
this is my program
int r = 0 ;
while ( ar[j]!="0" )
{
//cout << "Salman majid is \n" ;
if ( ar[j]==k )
{
r = j ;
getdata() ;
int b = 0 ;
cout << "after updating :\n" ;
while(ar[b]!="0")
{
cout << ar[b] << " " ;
b++ ;
}
//############################################################################################
ofstream of ("C:/Users/MR_Salman/Desktop/student records.txt",ios::out|ios::binary);
int x = 0 ;
while ( ar[x]!="0" )
{
of<<ar[x] << " ";
if ( ar[x] == ";" )
{
of << "\n\n" ;
}
x++ ;
}
cout << "data is written \n" ;
//cout << ar[x] << " " ;
//x++ ;
}
There sees to be a lot missing, the code starts in the middle of something. I don't see any headers, or main(), but importantly, I've no idea what is ar here:while ( ar[j]!="0" ) and I can't see the code for getdata().