Skip to main content
Search
Search This Blog
Leegoonz game Developer blog.
Visual strategy development lab Technical Art Director. Now working atAllegorithmic.
페이지
Home
About Leegoonz
LEEGOONZ.COM
ADVANCED SHADER DOT COM
ADVANCED SHADER FACEBOOK COMMUNITY
Substance user group in korea
More…
Share
Get link
Facebook
X
Pinterest
Email
Other Apps
Labels
programming
October 31, 2011
텍스트 야구 게임.~
#include
#include
#define ERROR "다시 입력해라" using namespace std; void main() { int Com[3]; int Input; int Play[3]; int Cnt = 0; int Strike = 0, Ball = 0; int Dest, Sour, Temp; int Num[10]; char szInput[4]; srand(time(NULL)); for(int i = 0; i < 10; i++) { Num[i] = i; } for(int i = 0; i < 3 * 10; i++) { Dest = rand() % 10; Sour = rand() % 10; Temp = Num[Dest]; Num[Dest] = Num[Sour]; Num[Sour] = Temp; } if(Num[0] != 0) { Com[0] = Num[0]; } else { Com[0] = Num[9]; } Com[1] = Num[1]; Com[2] = Num[2]; //cout << Com[0] << Com[1] << Com[2] << endl; while(true) { Strike = 0, Ball = 0; cout << "숫자를 입력해라 : (3자리)"; cin >> szInput; //cin >> Input; Cnt++; /* if(100 > Input || Input > 999) { cout << ERROR << endl; continue; } */ // Play[0] = Input / 100; // Play[1] = (Input % 100) / 10; // Play[2] = Input % 10; Play[0] = szInput[0] - 48; Play[1] = szInput[1] - 48; Play[2] = szInput[2] - 48; cout << Play[0] < for(int i = 0; i < 3; i++) { for(int j = 0; j < 3; j++) { //숫자가 같다 if(Com[i] == Play[j]) { //자리수도 같다 if(i == j) { Strike++; } else { Ball++; } } } } cout << Strike << "Strike\t" << Ball << "Ball" << endl; if(Strike == 3) { system("cls"); cout << Cnt << " 만에 성공" << endl; break; } } }
Game Developer Leegoon copyright all right reserved since 2010.
Comments
Popular Posts
December 14, 2013
AO with Gamma Control for Matcap bump Unlit shader
December 06, 2013
Jean Moreno 님이 제공 하신 MatCap 쉐이더를 조금 손봤습니다.
Comments
Post a Comment
덧글쓰기 기능 있는거 아시죠? ㅋㅋ