hi,
pls tel me if there is any mistake in this code. I couldnt figure out the problem, in this program, the scanf statement scanf ("%c",&xit) doesnt get executed... i use FC4 linux and gcc 4.0 version. Pls tel me what is the problem or its a prb with linux???
o/p is:
bash-3.00$ gcc sample.c
bash-3.00$ ./a.out
Enter choice
1) create
2) solve
3) exit
3
Do you really want to quit: continue....
bash-3.00$
it is not asking for the input of xit itself!!! i also tried uysing xit = getchar(); that also dint work!! wats the problem.
/legolas
pls tel me if there is any mistake in this code. I couldnt figure out the problem, in this program, the scanf statement scanf ("%c",&xit) doesnt get executed... i use FC4 linux and gcc 4.0 version. Pls tel me what is the problem or its a prb with linux???
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int choice=0;
char xit;
printf("Enter Choice:\n 1) Create\n 2) Solve\n 3) exit\n");
scanf( "%d", &choice );
printf( "\n" );
if ( choice == 1 )
printf ( "yet to create\n" );
else
{
printf ( "Do you really want to quit?" );
scanf ( "%c", &xit );
if ( xit == 'y' )
exit(0);
else
printf("continue...\n");
}
return(0);
}
o/p is:
bash-3.00$ gcc sample.c
bash-3.00$ ./a.out
Enter choice
1) create
2) solve
3) exit
3
Do you really want to quit: continue....
bash-3.00$
it is not asking for the input of xit itself!!! i also tried uysing xit = getchar(); that also dint work!! wats the problem.
/legolas