找下列代码中的问题
#include <iostream>
using namespace std;
char c;
unsigned long long x,n=0,point=1,tp,yn;
string s,q,t = "0123456789ABCDEF";
int main(){
cin >> q;
cout<<'{';
if(q[1]=='}'){
cout<<'}';
return 0;
}
while(point<q.length()){
s="";
tp=point;
while(q[point]>='0'){
n*=10;
n+=q[point]-'0';
point++;
}
yn=n;
while(n != 0){
x = n % 16;
if(x < 10){
c = x + '0';
}else{
c = x + 'A' - 10;
}
s = c + s;
n = n / 16;
}
if(s.length()+2>point-tp) {cout<<yn;}
else {cout<<"0x"<<s;}
point++;
if(q[point-1]=='}') break;
cout<<',';
}
cout<<'}';
return 0;
}
——————————答案——————————
有没有一种可能
‘}’的ASCLL码值是125
而‘9’只有57
所以第18行的条件判断一无是处……