想看題目請點我
#include <iostream> using namespace std; main() { string ID ; int code[26]={10,11,12,13,14, 15,16,17,34,18, 19,20,21,22,35, 23,24,25,26,27, 28,29,32,30,31, 33} ; while(cin >> ID) { int sum = 0 , number[11] , flag = 0; //number for(int i = ID.length() , j = 0 ; i>1 ; i-- , j++ ) { number[i] = (ID[i-1] -48); if(j==0) sum += number[i] ; else sum += number[i] * j ; } //English number[0] = code[(ID[0]-65)] / 10 ; number[1] = code[(ID[0]-65)] % 10 ; //Calculation 計算 sum += number[0] + (number[1] * 9) ; //printf if((sum%10)==0) cout << "real" << endl ; else cout << "fake" << endl ; } }