Home > Back-end >  Code input there is a problem how to change
Code input there is a problem how to change

Time:09-30

#include
#include
#include
Int main () {
Char b [20];//store name temporary variable
//STD: : string name; Deposit//keyboard input name
STD: : vector Vname;//storage container name
While (1) {
Printf (" please enter a name (0) : ");
Scanf_s (" % c ", b);
If (STRCMP (b, "0")==0) break;//input end 0
Vname. Push_back (b);//the input the name of the storage containers
}
For (int I=0; i Printf (" what is your name on the input: % s ", vname);
}
return 0;
}

CodePudding user response:

Scanf_s (" % c ", b); Input format is wrong, to scanf_s (" % s ", b, sizeof (b));

CodePudding user response:

reference 1st floor qybao response:
scanf_s (" % c ", b); Input format is wrong, to scanf_s (" % s ", b, sizeof (b));

No output is garbled

CodePudding user response:

Utf-8 encoding format?
  • Related