Home > Back-end >  A novice just learning c books have an example
A novice just learning c books have an example

Time:10-09

Topic: a c + + small topic. Write a program to read the keyboard input, until meet the @ symbol, and echo input, at the same time converts uppercase characters to lowercase, converts lowercase letters to uppercase,
#include
#include
#include
#include
using namespace std;
Int main () {
char ch;
Cout<& lt;" Both please enter: ";
Cin> Ch;
while(ch!='@') {
If (islower (ch)) {
Cout};
If (isupper (ch)) {
Cout};
Cin> Ch;
};
CoutCin. The get ();
system("pause");
} this is the code I wrote, but why is the value of the int type output rather than the type char

CodePudding user response:

 cout<(char) ch - 32; 
  • Related