소스 ¶
~cpp #include <stdlib.h> #include <iostream.h> int main() { char reg_num[13]; int sum=0; int count = 0; cout << "주민등록번호를 '-'없이 입력해주세요" << endl; cin >> reg_num ; for (count = 0 ; count <12 ;count++) { reg_num[count] -=48 ; if (count <8) { sum = sum + reg_num[count]*(count+2); } else { sum = sum + reg_num[count]*(count-6); } } reg_num[12] -=48; if (reg_num[12] == (11-(sum)%11)) { cout << "대한민국 국민이네요~ ^^ 안녕하세요!" << endl; } else { cout << "혹시 간첩???? -_-;; " << endl; } system("pause"); return 0; }