~cpp
#include<iostream> // 함 iostream 포함 .
#include <ctime> // time(0) 해 합.
using namespace std;
void main()
{
// srand(time(0)); // rand() 합.
// 하 행할 . -_-;;
// int x = rand(); // rand()함 한 하 함.
// 하 0 ~ 큰 .
// int x1 = rand() % 10; // % 10 하 x1 10
// 0 ~ 9 하 .
// int x2 = rand() % 9 + 1; // % 9 하 0~9
// 1 하 1~10 .
cout << " 하 : " << endl;
srand(time(0));
int x;
int a[3];
do
{
x = rand() % 1000;
a[0] = x/100;
a[1] = (x-(a[0]*100))/10;
a[2] = (x-(a[0]*100)-(a[1]*10))/1;
}while(a[0]==a[1]||a[1]==a[2]||a[0]==a[2]);
cout << a[0]<<a[1]<<a[2] << endl;
int soo;
do
{
cin >> soo;
int c[3];
c[0] = soo/100;
c[1] = (soo-(c[0]*100))/10;
c[2] = (soo-(c[0]*100)-(c[1]*10))/1;
int i;
int count =0;
int count2=0;
for(i=0; i<3; i++)
{
if (a[i] == c[i])
count++ ;
}
cout << count << " strike"<<"\t";
if (a[0]==c[1])
count2++;
if (a[0]==c[2])
count2++;
if (a[1]==c[0])
count2++;
if (a[1]==c[2])
count2++;
if (a[2]==c[0])
count2++;
if (a[2]==c[1])
count2++;
cout << count2 << " ball" << endl;
if (count == 3)
{
cout << " !!"<<endl;
cout << " ~!!"<< endl;
}
}while (soo!=x);
}