U E D R , A S I H C RSS

새싹교실/2012/새싹교실강사교육/2주차

2

2 : Second Impact!
- , , GCC, , main, 변, Data Type, , , 문 -
돼! ( )
1. Ice Breaking Wiki .
2. , , . .. 등
3.
4. 모르는 API 문 http://winapi.co.kr -> 2 딩 Q&A
5. Wiki

1.
http://wiki.zeropage.org/wiki.php//2011/무/벨4
+ 붙 !
///  !!
#include<stdio.h>
#include<math.h> //Rand를 
#include<stdlib.h> 
#include<time.h>
#define KICK 350
#define PUNCH 200
#define SORAKICK 900
#define SORAPUNCH 1000
int main(){
	//  , 내  .
	int Sora = 2500, My = 5000; 
	int temp; // 
	char select; // 
	srand(time(NULL)); //Rand .
	printf("  .\n");
	printf(" : 06  11    Target : 11 \n");
	while(1){
		printf("  : %d\n",Sora);
		printf("내  : %d\n",My);
		printf(" : k 먹 : p\n");
		// 
		select = getch(); //getch()는 char 를 받.
		switch(select){
			default: printf(" \n"); break;
			case 'k' : 
				temp = ( ( rand() % KICK +1)); //1~KICK 데미.
				printf(". 데미 : %d 를 !\n",temp);
				Sora = Sora - temp;  break;
			case 'p' :
				temp = ( ( rand() % PUNCH +1));
				printf(". 데미 : %d 를 !\n",temp);
				
				Sora = Sora - temp; break;
		} //내 
		select = rand() %2 +1;// 덤.
		switch(select){
			case 1 : 
				temp = ( ( rand() % SORAKICK +1));
				printf(" . 데미 : %d 를 !\n",temp);
				My = My - temp;  break;
			case 2 : 
				temp = ( ( rand() % SORAPUNCH + 1));
				printf(" . 데미 : %d 를 !\n",temp);
				My = My - temp; break;
		}// 
		//
		//	 복
	
		if(Sora <= 0 && My <= 0){
			printf("Double KO.  .\n");
			break;
		}
		else if(Sora <= 0){
			printf("!!! \\(* ^ * )/ \n");
			break;
		}
		else if(My <= 0 ){
			printf(" .. OTL \n");
			break;//while문 .
		}
		// ?    
	}
	printf("\nGame Over\n");
	return 0;
	}
? .

2. 딩 Q&A(모른, 배 ! )
2.1


2.2 #include<stdio.h>, printf(), scanf(); .


2.3 int, char, 변.


2.4 #define 문, 매


2.5 #include<math.h>, #include<stdlib.h>, #include<time.h>
srand(time(NULL)), rand(). 브러리.


2.6 If문, switch() { case : default : } 문.

3.
ACM . *^_^* 뿌~!




디 : zeldababo 밀번 : rlawns

~! !

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:45
Processing time 0.0136 sec