I'm not sure where I went wrong with this - pls help

Hello,

I'm writing a simple program that will book seats on a flight but I've been struggling with this section of code for a few days now and decided to seek some help. whe I run this section, I get both pieces of output "That seat has already bee booked" and "Seat %d has been booked". I'm trying to prevent double booking a seat and while the program will not double book the seat, I still get these conflicting messages. Can anyone give me some suggestions to clear this up? I've posted the section of code below.

In addition to elad's point, you want to watch your use of ;
if ( foo );
while ( foo );
These do nothing useful - indeed the second will cause the program to halt if the conditional expression never changes (as it does in your case)

I think Salem means that a semicolon immediately after the conditional of an if, while, or for statement will cause the body of the loop following the conditional to be ignored. For example the semicolon below means that do something will never get done.

if(foo);
{
//do something;
}

Same here:

while(foo);
{
//do something;
}

However, in do...while loops, the conditional comes after the body of the loop, so the semicolon is needed

And this will just throw ya into an infinite loop in most cases, and it will never even get to the opening brace.

Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Sorry, foo is just a generic term that can stand in for any legal statement in the setting it is used. bar is another common generic term. As I understand it egend has it that foobar used to be a slang phrase that meant something like "who cares?" or "whatever" and it has found roots in programming as a generic fill in.