I just looked over your program quickly and noticed a few things.
> void main ()
main always returns an int
> f=fopen("c:\\felicias\\airline.txt", "r");
You should check the file pointer to make sure the file is opened properly
Code:
while (! feof(f))
{
fscanf(f, "%d ", & flt[x].flytno);
fgets(flt[x].orig,16,f);
fgetchar();
fgets(flt[x].time,9,f);
fgetchar();
fgets(flt[x].date,9,f);
fscanf(f, "\n");
x++;
}
You shouldn't control your loop with feof(). Check out this faq.
Also, you are reading more data than you should. The origin field was supposed to have 15 chars plus 1 space. You are reading 16 chars and then reading another right after.
Code:
void input_selection(int *sel)
{
cout<<"Selection? (1-4) ";
cin>>*sel;
}
This is the only thing I see that might be the cause of your problem. You never flush the output buffer, so your program might be waiting for input without ever displaying the prompt. In this case, it will look like the program has hung right after displaying the menu. Trying adding << flush to the end of your cout statement.
Code:
cout<<"Enter origination point you're looking for: ";
gets(srchflt);
Same problem here. By the way, are you using C or C++? It's really not good form to mix C and C++ IO in one program. And even if you did want to use C IO, gets() is bad.
I hope that helps.
-tf