解题思路:灵活利用ASCII表
注意事项:
参考代码:
# include <iostream> # include <string> using namespace std; int main() { string a; while (cin >> a) { int j = 1; int num = 0; for (int i = 0; i < a.size() - 1; i++) { if (a[i] != '-') { num = num + ((a[i] - 48) * j); j++; } } num %= 11; if (num >= 10) { num = 88; if ((a[12]) == num) { a = "Right"; cout << a << endl; } else { a[12] = num; cout << a << endl; } } else { if ((a[12] - 48) == num) { a = "Right"; cout << a << endl; } else { a[12] = num + 48; cout << a << endl; } } } return 0; }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题9.8 (Java代码)浏览:1674 |
输出正反三角形 (C语言代码)格式错误!!!浏览:1177 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:626 |
WU-拆分位数 (C++代码)浏览:819 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:642 |
1157题解浏览:769 |
1014题解浏览:524 |
Hello, world! (C语言代码)浏览:766 |
循环入门练习5 (C语言代码)浏览:908 |
1118(求助_已解决)浏览:351 |