Try this.
Code:
#include<iostream>
using namespace std;
const max_videos = 100;
struct video{
char* title;
char* num;
char* catagory;
};
void GetYesOrNo(char& response);
int main()
{
int index = 0;
char response;
char temp[100] = " ";
video* vptr;
vptr = new video[max_videos];
do
{
cout << "Enter video title: ";
cin.get(temp, 100, '\n');
cin.ignore(100, '\n');
vptr[index].title = new char[strlen(temp) + 1];
strcpy(vptr[index].title, temp);
strcpy(temp, " ");
cout << endl;
cout << "Enter number in store: ";
cin.get(temp, 100, '\n');
cin.ignore(100, '\n');
vptr[index].num = new char[strlen(temp) + 1];
strcpy(vptr[index].num, temp);
strcpy(temp, " ");
cout << endl;
cout << "Enter video catagory: ";
cin.get(temp, 100, '\n');
cin.ignore(100, '\n');
vptr[index].catagory = new char[strlen(temp) + 1];
strcpy(vptr[index].catagory, temp);
strcpy(temp, " ");
cout << endl;
cout << "***************************************" << endl << endl;
cout << "You have entered the following: " << endl << endl;
cout << "Title: " << vptr[index].title << endl;
cout << "Stock: " << vptr[index].num << endl;
cout << "Catagory: " << vptr[index].catagory << endl;
cout << "Do you wish to continue with the Database? (y or n): ";
GetYesOrNo(response);
if(response == 'y')
{
index++;
}
} while(response == 'y');
return 0;
}
//----------------------------------------------------------------------------------------
void GetYesOrNo(char& response)
{
do
{
cin >> response;
cin.ignore(100, '\n');
if(response != 'y' && response != 'n')
cout << "Please enter 'y' or 'n': " << endl << endl;
}while(response != 'y' && response != 'n');
cout << endl;
}