I had been out of school for about ten years and decided to return to college and major in programming. Good choice but I've been in over my head since day one. In any event I need help in accessing the text file then compairing user input with text files for verification. In the exact words of my assigment, "prompt user for store id and if valid print store's information to screen. Here's what I have so far. Please don't laugh at me..I've just started and at the point where i'm trying everything.
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>
struct Store{ //Store Structure
int storeid; //Structure members
char storename[20];
char storeaddress[30];
char citystate[30];
int zipcode;
};
int main()
{
cout <<" WELCOME TO NORMAN'S CONSUMER CLEARINGHOUSE "<<endl;
cout <<"____________________________________________________________"<<endl;
cout<<"Enter your store identification to procede:"<<endl;
cin>>storeid;
ifstream input;
input.open("stores.txt"); //open store file
if (input.fail())
{
cout <<"File does not exist."<<endl;
cout <<"Exit Program."<<endl;
return 0;
}
while (!input.eof()) //continue if not end of file
{
input.getline(storeid, 7, "#");
cout <<storeid <<endl;
}
input.close();
system("PAUSE");
return 0;
}