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










