~cpp 
#include <iostream>  
#include <ctime> 
using namespace std; 
int main() 
{   
	cout<<"야구게임입니다.\n";
	srand(time(0)); 
	int a = rand()%10;
    int b = rand()%10;
	int c = rand()%10;
	while ( a==b || b==c || a==c)
	{	a = rand()%10;
	    b = rand()%10;
		c = rand()%10;
	}
	
	cout << a << b << c << endl;
	
{
	int j,k;	
do
{
	int i;
	cout<<"숫자를 입력하시오\n";
    cin>>i;
	
	 j = 0;
	
	if(i/100 == a)
		j++;
	if((i / 10) % 10 == b)
		j++;
	if(i % 10 == c)
		j++;    
     k = 0;
	if(i / 100 == b || i / 100 == c)
		k++;
	if((i / 10) % 10 == a || (i / 10) % 10 == c )
		k++;
	if(i % 10 ==a || i % 10 ==b )
	    k++;
	
	cout << j << "S" << endl;
	cout << k << "B" << endl;
} while(j!=3);
	
}
  return 0;
}