Home > Back-end >  Why my program output if the statement in twice
Why my program output if the statement in twice

Time:09-24

CodePudding user response:

# include
Int main ()
{
Char c, c;//define two variables stored and uppercase lowercase c c
Printf (" do input a lowercase character: \ n ");//enter a lowercase letter

While (1)
{
C=getchar ();
If (c & lt; 97 | | c> 122)//testing input to lowercase, if enter the else and jump out of the loop, if otherwise enter again
{
Printf (" your input is wrong! Both Please press on with the new input: \ n ");
}
The else
{
C=C - 32;
Printf (" The capital is: % \ n "c, c);
break;
}
}
return 0;

}
This is my code, the program achieve enter a corresponding uppercase lowercase output

CodePudding user response:

Actually you input the two characters, A A, A carriage return,

CodePudding user response:

C=getchar ();
The following add
Setbuf (stdin, NULL);
Or directly
Then a getchar ();

CodePudding user response:

reference 3 floor truth is right or wrong response:
c=getchar ();
The following add
Setbuf (stdin, NULL);
Or directly
Then a getchar ();

Oww, thank you thank you
  • Related