输入16位以内长的字符串就正常,
输入16位以外长的字符串就会出现乱码??多三位乱码
#include <iostream>
#include <string.h>
using namespace std;
void jiami1();
void jiami2();
void jiami3();
int main(){
char a[101];
int n;
cin.getline(a,100);
string s2;
s2=(string)a;
cout<<a<<endl;
cout<<s2<<endl;
int length = s2.length();
int chu = length/16;
int mod = length%16;
for (int i = length;i<(chu+1)*16;i++){
a[i] ='-';
}
cout<<a<<endl;
string s3;
s3 = (string)a;
cout<<s3.length()<<endl;
return 0;
}
习惯受伤
相关分类