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.0253 sec