Hey there,
I was wondering if anyone is any good with C++, doing my project for my HNC in computing and having a problem.
I've made a struct into which data is being written to, I now need to change the data in the particual record held in the struct. I have done this by doing a search of the struct first via the app.no. in the struct. This appears to be working and the data is being changed in the record I have searched for. The problem is when i'm now displaying the records it appears the program is writting a 0 into the first field of the next record, ie the next app.no
Here is the part of the code i'm trying to fix...
void amend_record(mob_app app[], int row)
{
clrscr();
cout << "this is Search\n";
int no;
cout << "Enter Customer Number : ";
Input(no);
for (int r=0;r<row;r++)
{
if ( no == app[r].no )
{
clrscr();
cout << app[r].no <<endl;
cout << app[r].name <<endl;
cout << app[r].url <<endl;
cout << app[r].description <<endl;
cout << app[r].price <<endl;
cout << app[r].category <<endl;
cout << app[r].price <<endl;
cout << app[r].rating <<endl;
cout << "please input new app no. : " ;
Input(app[r].no);
cout << "please input new app name : " ;
Input(app[r].name,20);
cout << "please input new app url : " ;
Input(app[r].url,20);
cout << "please input new app description : " ;
Input(app[r].description,20);
cout << "please input new app price : " ;
Input(app[r].price);
cout << "please input new app category : " ;
Input(app[r].category,20);
cout << "please input new app price : " ;
Input(app[r].price);
cout << "please input new app rating : " ;
Input(app[r].rating,20);
cin.ignore(1);
write_file(app,row);
row++;
}
}
input();
}
I have tried putting in cin.ignore(1) but to no avail
If anyone could help it'd be greatly appreciated.
Thanks,
K