U E D R , A S I H C RSS

숫자야구/강희경

~!!!
~cpp 
#include <iostream>  
#include <ctime> 
using namespace std;  
 
void ballcount(); 
void strcount();
void manual();
void selection();
void game();
void loading();
void judgment();
 
int strike, ball, select, count;
 
int main()  
{  
    selection();
	judgment();
	cout << endl << ":  ~!!" << endl;
    loading();
	return 0;
}  
 
void ballcount() 
{ 
    if(ball == 3) 
        cout << " ~ " <<endl; 
    else if(ball == 2) 
        cout << "투 ~ "<<endl; 
    else if(ball == 1) 
        cout << " ~ "<<endl; 
    else 
            cout << endl; 
} 
 
void strcount() 
{ 
    if(strike == 3 ) 
		cout << " 크~ " <<endl;
    else if(strike == 2) 
            cout << "투 크~ "; 
    else if(strike == 1) 
            cout << " 크~ "; 
}
void manual()
{
		
	cout << "☞:   3  " << endl;
	cout << "                ." << endl;
	cout << "☞크:     ," << endl;
	cout << "                ~" << endl;
	cout << "☞:  &#52675;  " << endl;
	cout << "☞:  " << endl;
	cout << "☞:  123  521 ," << endl; 
	cout << "      567  !, 123 크!" << endl;
	cout << "---------------------------------------------------" << endl;
	selection();
}
void selection()
{
	char dustbox[10];
	cout << "1.                         2. " << endl;
	cout << "3. " << endl;
	cout << "☞ 택 해:_\b";
	if(cin >> select )
	{	
		cout << "---------------------------------------------------" << endl;
	    game();
	}
	else
	{	
		cout << " ." << endl;
	}
}
void game()
{
	switch(select)
	{
		case 1 :
				manual();
				break;
     
			
		case 2 :
			    count = 1;
			    do{ 
						srand(time(0)); 
						int num = rand() % 899 + 100; 
						int num_m[3]; 
						num_m[0] = num % 10; 
						num_m[1] = (num/10) % 10; 
						num_m[2] = num/100; 
						if(num_m[0] != num_m[1] && num_m[0] != num_m[2] 
							&& num_m[1] != num_m[2]) 
						{ 
							cout << "   ." << endl;
								loading();
							do 
							{ 
								cout << endl << " " 
									 <<"   "; 
								cout << endl << count << " ☞ "
									 << "  BOA: ___\b\b\b"; 
								int answer; 
								if(cin >> answer)
								{
									if((answer >100) && (answer < 1000))
									{
										int ans_m[3]; 
										ans_m[0] = answer % 10; 
										ans_m[1] = (answer/10) % 10; 
										ans_m[2] = answer/100; 
										strike = 0; 
										ball = 0;  
										for(int i = 0; i<3; i++) 
										{ 
											for(int j = 0; j<3; j++) 
											{ 
												if(ans_m[i] == num_m[j]) 
												{ 
													if(i==j) 
													{ 
														strike++; 
													} 
													else 
														ball++; 
												} 
											} 
										}
										count++;
										cout << endl;
										strcount(); 
										ballcount();
										if(strike == 0 && ball == 0) 
											cout << " "<<endl;
									} 
									else
										cout << "\a !!" 
										<< endl;
								}
								else
								{
									cout << "." << endl;
									count = 0;
									strike = 3;
								}
							}while(strike!= 3); 
					}  
				}while(strike!= 3);
				break;
		case 3 : cout << "." << endl;
			break;
		default : cout << "\a ." << endl;
			cout << " ." << endl << endl;
			selection();
	}  
}
void loading()
{
	for(int i = 0; i < 50000000; i++)
	{
		if(i == 10000000)
			cout << "■";
		else if(i == 20000000)
			cout << "■";
		else if(i == 30000000)
			cout << "■";
		else if(i == 40000000)
			cout << "■";
		else if(i == 45000000)
			cout << "■" << endl;
	}
}
void judgment()
{
	if(count != 0 && count <= 6)
	{
		cout << count-1 << " ." << endl;
		cout << " !!!" << endl;
	}
	else if(count > 5 && count <= 11)
	{
		cout << count-1 << " ." << endl;
		cout << " ~" << endl;
	}
	else if(count > 11)
	{
		cout << count-1 << " ." << endl;
		cout << "!! ~" << endl;
	}
}
	    


팩토 . 해하 ? , 팩토 .
--
DeleteMe) .



Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:15
Processing time 0.0246 sec