结论:
汉字转数字后,会占两位字符位,两位都是负数。
参考下面代码
输入:你
输出:01
#include<bits/stdc++.h>
using namespace std;
int main() {
char s[10000];
gets(s);
for(int i = 0; i < strlen(s); i ++) {
if(s[i] < 0) {
printf("%d", i);
}
}
return 0;
}
结论:
汉字转数字后,会占两位字符位,两位都是负数。
参考下面代码
输入:你
输出:01
#include<bits/stdc++.h>
using namespace std;
int main() {
char s[10000];
gets(s);
for(int i = 0; i < strlen(s); i ++) {
if(s[i] < 0) {
printf("%d", i);
}
}
return 0;
}