I need to add a string in here somewhere...any ideas where or how to do it?
[CODE]
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
int main()
{
// Declare variables
char band [80];
char cd_name [80];
int found;
ifstream infile;
found = 0;
cout << "Sheila Blakely\n";
cout << "Final 2002\n\n";
cout << "Music Library";
//Input from the user
cout << "Enter a singer or band name: ";
cin.get(band,80);
cin.ignore(80, '\n');
cout << '\n';
infile.open ("LIBRARY.TXT", ios::in); // open the library file
if(infile)
{
do
{
infile.get(band, 80); // get the band from the file
infile.ignore(80, '\n');
infile.get(cd_name, 80); // get the CD name from the file
infile.ignore (80, '\n');
if ((strcmp (cd_name, band)) == 0 )
{
found = 1;
break;
}
}
while (found != 1 && !infile.eof());
}
else
{
"An error occured while opening the file.\n";
}
infile.close(); // close the input file
if (found == 1)
{
cout << "The book title that you requested is in our inventory.\n";
cout << "***CD Information*** \n";
cout << '\n';
cout << "CD Title: " << cd_name << '\n'; // print the title of the CD
cout << "Band/Singer: " << band << '\n'; // print the band or singer name
}
else
{
cout << "The band or singer you typed in must not be very good\n";
cout << "we don't waste time with bad music.\n";
}
return 0;
}