Hi guys,
I keep trying to compile the code of a small program that I have been creating just as a learning exerciser again but keep coming up against an error - "error C2065: 'gets' : undeclared identifier" but I can't see where I'm going wrong in the code for that to happen - anyone any ideas ? My code is:
Code:
void add_video(videorecord_type videos[])
{
int no_of_videos, next_record_no, year;
float price;
char tempstring[STOCK_ID_SIZE+1];
//Display heading
clear_screen();
cout << " ADD A VIDEO TO STOCK"
<< endl << endl << endl;
//Count how many videos are already in the database
no_of_videos = video_count(videos);
//Report to user
cout << endl << "There are " << no_of_videos << " videos in VIDEO LIBRARY. " << endl;
//Set the record number at which to add the new video
next_record_no = no_of_videos;
//If database is not full, add a video
if (no_of_videos < MAX_VIDEOS)
{
//Get the stock ID as a temp string
cout << endl << "Stock ID: " << flush;
cin >> tempstring;
//Check this stock_ID doesn't already exist
if (record_no(videos,tempstring) == -1)
{
strcpy(videos[next_record_no].stock_ID, tempstring);
cout << "Video Title: " << flush;
gets(videos[next_record_no].title);
do
{
cout << "Year of release: ";
cin >> year;
if (year < 1950 || year > 2050)
{
cout << "Year muct be in range 1950 to 2050\a" << endl;
}
}while (year < 1950 || year > 2050);
videos[next_record_no].year = year;
do
{
cout << "Price: ";
cin >> price;
if (price < 1.0 || price > 20.0)
{
cout << "Price must be in the range £1 to £20\a" << endl;
}
}while (price < 1.0 || price > 20.0);
videos[next_record_no].price = price;
}
else
{
cout << "This stock ID already exists\a" << endl;
}
}
//If database full, give message
else
{
cout << "No room for any more videos\a" << endl;
}
//Database has changed so save it
save_data(videos);
}
Thanks guys for any input
H_M