标签:pre clu namespace style cst out stream div code
#include <iostream> #include <iomanip> #include <cstdlib> #include <string> using namespace std; int main(){ string s; cin>>s; //0-970-82162-4 int m = ((int)s[0] -48) * 1; m += ((int)s[2] - 48) * 2; m += ((int)s[3] -48) * 3; m += ((int)s[4] -48) * 4; m += ((int)s[6] -48) * 5; m += ((int)s[7] -48) * 6; m += ((int)s[8] -48) * 7; m += ((int)s[9] -48) * 8; m += ((int)s[10] -48) * 9; int n = m % 11; int t = (int)s[12] -48; if(s[12] == ‘X‘) t = 10; if(n == t) cout<<"Right"; else { if(n != 10) s[12] = n + 48; else s[12] = ‘X‘; cout<<s; } // cout<<setiosflags(ios::fixed)<<setprecision(4)<<s<<endl; // cout<< setiosflags(ios::fixed)<<setprecision(4) <<c<<endl; }
标签:pre clu namespace style cst out stream div code
原文地址:http://www.cnblogs.com/shiningrise/p/6502100.html