~cpp #include <iostream> // iostream . #include <ctime> using namespace std; int main() { srand(time(0)); // rand() 값 . // 값 . -_-;; int base = rand() % 1000; // % 9 0~9까 갈 고 // 거기 1 1~10 까 . int a,b,c,d,e,f; int S=0,B=0,O=0; cout << base << "\n"; a = base/100; b = (base%100)/10; c = (base%100)%10; int input; cout << " .\n"; cin >> input; d = input/100; e = (input%100)/10; f = (input%100)%10; int abc[3]={a, b, c}; int def[3]={d, e, f}; int i,j; while(a!=def[0] || b!=def[1] || c!=def[2]) { for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(abc[i]==def[j]) { if(i==j) S++; else B++; } } } if(S==0 && B==0) cout << "Out\n"; else if(S==3) { cout << " .\n" ; break; } else cout << S <<" S " << B <<" B " <<endl; S=0,B=0; cin >> input; def[0] = input/100; def[1] = (input%100)/10; def[2] = (input%100)%10; } return 0; }