cuijh007 @ 2022-03-01 19:48:56
#include<iostream>
#include<string>
using namespace std;
int main () {
string str;
char c;
int sum=0, i=1;
cin>>str;
// getline(cin, str);
for(string::iterator it=str.begin(); it!=str.end()-1; it++) {
if(*it>47 && *it<58) {
sum += (*it-'0') * i++;
}
}
// cout<<str;
if(sum%11 == 10) c = 'X';
else c = sum%11 + '0';
if(c == *(str.end()-1)) {
cout<<"Rigth";
} else {
*(str.end()-1) = c;
cout<<str;
}
return 0;
}
by CSN_ @ 2022-03-01 19:54:05
cout<<"Rigth";
打错了
应该是:
cout<<"Right";
by Ginger_he @ 2022-03-01 19:54:25
string
为什么要指针……