~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;
}