Can someone tell me what i'm missing. i think i've been looking at this code too long, and i've had too many variations of it to see it myself. any help is greatly appreciated.
Code:
#include <stdio.h>
int main(void)
{
int firstclass[3] = {0};
int coachclass[5] = {0};
int code = 0;
int i = 0;
int fccount = 0;
int cccount = 0;
while (code != 99)
{
if (fccount < 3)
{
printf( "Press [1] for First Class\n" );
}
else
{
printf( "First Class not available\n" );
{
if (cccount < 5)
{
printf( "Press [2] for Coach Class\n" );
}
else
{
printf( "Coach Class not available.\n" );
}
if ((fccount > 3) && (cccount > 5))
{
break;
}
scanf( "%d", &code );
if (code == 1)
{
firstclass[fccount] = 1;
fccount = fccount + 1;
code = 0;
}
else if ( code == 2 )
{
coachclass[cccount] = 1;
cccount = cccount +1;
code = 0;
}
else if ( code == 99 )
{
printf( "You have entered << 99 >> this program has ended\n" );
}
else
{
printf( "Invalid code - please try again\n\n" );
code = 0;
}
}
return 0;
}