Flight Reservation Program, I need help.

J

jawdoc

For a computer science class that I am taking, I am instructed to add
on to the code that my instructor has written so that the user can
make reservations using the makeReservation function and use getInfo
and showInfo to put information into SEAT structs for each user and
for each seat. I am slowly making my way through it and I can enter in
information for one user and it will show his or her information but
after it displays the struct it goes back to the menu and begins going
into an infinite loop wanting the user to enter in whether or not they
want to find it automatically or manually.

The cin.clear() method did not excactly work. And also when I am asked
by the getInfo function if the information is correct, if I enter yes
it goes back to the menu which somehow triggers an infinite loop. I
thought maybe it was in the do while loop in main. Also if I enter no,
when I am entering my name, it only accepts the first name and puts an
'o' in the place of the first name. i updated the existing code with
little things that I have changed.

My full code is here at http://www.chiefgamer.com/tman/airplanev2.cpp
 
C

Christopher

For a computer science class that I am taking, I am instructed to add
on to the code that my instructor has written so that the user can
make reservations using the makeReservation function and use getInfo
and showInfo to put information into SEAT structs for each user and
for each seat. I am slowly making my way through it and I can enter in
information for one user and it will show his or her information but
after it displays the struct it goes back to the menu and begins going
into an infinite loop wanting the user to enter in whether or not they
want to find it automatically or manually.

The cin.clear() method did not excactly work. And also when I am asked
by the getInfo function if the information is correct, if I enter yes
it goes back to the menu which somehow triggers an infinite loop. I
thought maybe it was in the do while loop in main. Also if I enter no,
when I am entering my name, it only accepts the first name and puts an
'o' in the place of the first name. i updated the existing code with
little things that I have changed.

My full code is here athttp://www.chiefgamer.com/tman/airplanev2.cpp

cin::clear, clears the error bits. It does not clear the contents of
the stream.
You will need to use cin::ignore to extract remaining characters from
the stream.
You check the error bits, i _think_, via cin::fail() cin::eof() and
cin::bad()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top