return;
counter xxx;
if(inFile.fail())return;
while(!inFile.eof())
{
inFile.get(xxx.name, 25, '#');
inFile.ignore(1);
inFile >> xxx.seats;
inFile.ignore(100, '\n');
}
{
cout << endl << "Would you like to search for a name?";
cin >> xxx.name;
cin.ignore(100, '\n');
}
counter ddd[25];
char found=0;
short answer;
int total=0;
while(toupper(xxx.name[0]) == 'Y')
{
char newname[50];
cout << "Please enter a search name: ";
cin.getline(newname, 25);
for(short x = 0; x < 25; x++)
{
int numseats=0;
int total =0;
if(!strcmp(xxx.name,ddd[x].name))
{
numseats = ddd[x].seats;
total += numseats;
found = 'Y';
break;
}else
{
found = 'N';
}if(found == 'Y')
{
cout << "The name " << newname << " exists." << endl;
cout << "Would you like to enter another name?";
cin >> answer;
cin.ignore(100, '\n');
}
else
{
cout << "That name does not exist in the database." << endl;
cout << "Would you like to enter another name?";
cin >> xxx.name;
cin.ignore(100, '\n');
}
}
cout << "The total number of seats is: " << total << endl;
inFile.close();
}
if(0);
else
cout << "Error opening data file!" << endl;
}
John Fill
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.