Text file reading problem
Sep 21, 2013 at 5:55am UTC
This is my code, its judge the content that user input is correct or not, if correct, display those information. I want to modify on it to make it display all information without check "st" variable. How do I achieve that? Please help~~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
char st[20];char c;int j=0;int flag;
if (i==0)
{ cout<<"No information. Please reserve first!" <<endl;Sleep(2000);break ;}
do
{
flag=0;
//cout<<"Please enter the 【Start place】: ";
//cin>>st;
cout<<"\n------- Information of " <<st<<" -------" ;
for (int j=0;j<i;j++)
{
if (strcmp(st,(*s[j]).start)==0)
{
flag=1;
cout<<"\nFlight number: " <<(*s[j]).flight<<"\nDate: " <<(*s[j]).date<<"\nStart place: " <<(*s[j]).start<<"\nDestination: " <<(*s[j]).finish<<"\nDeparture time: " <<(*s[j]).stime<<"\nFligh type: " <<(*s[j]).ftype<<"\nPrice: " <<(*s[j]).price<<"\nPersonal Info: " <<(*s[j]).pinfo<<endl;
}
}
if (flag==0) cout<<"\nSorry, no result!" <<endl;
cout<<"\nDo you wanna continue? (y/n): " ;
cin>>c;
if (c!='n' &&c!='y' )
{
cout<<"Wrong operation. Please try again." <<endl;system("pause" );break ;
system("cls" );
cin>>c;
}
}while (c=='y' );
break ;
}
Topic archived. No new replies allowed.