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