2009 T

Size: px
Start display at page:

Download "2009 T"

Transcription

1 T Wii Visual C Express Edition Visual C Express Edition Paint.net ++ 1

2 2009 T

3 Visual C Express Edition

4 1 2 Visual C Express Edition Visual C Express Edition Visual C Express Edition DirectX Windows DirectX Windows 2.1 Visual C Express Edition Visual C Express Edition Visual C Express Edition Microsoft Visual Studio Express Edition Visual C Web ( ) Visual C Express Edition 2.2 Visual C Express Edition 4

5 2.3 Visual C Express Edition 1 Win32 Win32 2 C++ cpp 3 C/C++ (/MTd) 4 Debug Release (/MT) 1: 2: Win32 3: 4: Release 5

6 3 if for C #include DxLib.h #include <math.h> int WINAPI WinMain(){ #include DxLib.h C #include<stdio.h> DX int WINAPI WinMain() int main(void) #include <math.h> C 1sin cos ChangeWindowMode(); () TRUE () FALSE ChangeWindowMode(); 3.1 char Key[256]; GetHitKeyStateAll(Key); 6

7 Z Z Z Z if(key[ KEY INPUT Z]==1) 3.2 GetColor(255,255,255) GetColor(255,255,255) GetColor(255,0,0) GetColor(0,0,128) GetColor(255,255,0) GetColor(0,0,0) DX printf( ); (1)DrawString(100, 100,,GetColor(255,255,255)); (2)DrawFormatString(100,150,GetColor(255,0,0), Sum=% d,sum); (0,0) (640,480) (1) x,y GetColor(255,255,255) (100,100) (2) % d (1) (100,150) Sum 7

8 int Moji; Moji=CreateFontToHandle( HGS, 48, 1, DX FONTTYPE NORMAL); // (1) DrawStringToHandle(100,100,,GetColor(255, 255, 255),Moji); // (2A) DrawFormatStringToHandle(100,150,GetColor(255, 0, 0),Moji, % d,sum); // (2B) int (1) (1) HGS, HGS Moji (2A) (2B), HGS 3.4 int Picture1; Picture1=LoadGraph( Pic1.png ); // (1) DrawGraph(100, 100, Pic1, FALSE); // (2) int Picture1 (1) Pic1.png (2) (100,100) Pic1.png 5 5 int Picture2[100]; LoadDivGraph( Pic2.png, 16, 4, 4, 20, 20, Picture2); // (3) DrawGraph(100, 200, Picture2[0], FALSE); // (4) 5 Picture2[100] (3) Pic2.png Picture2[100] (2) Picture2 Pic2.png (4) (100,200) Pic2.png 8

9 double PI=3.14; DrawRotaGraph(100, 300, 2.0f, PI/2,Picture2[0],TRUE ); (100,300) 5 /2 2.0f double PI 5: Pic2.png 9

10 4 6 Game Start SPACE RETURN 6: 4.1 while 6 void GameStart(void) { while(1){ GetHitKeyStateAll( Key ) ; if( ProcessMessage() == -1 ) break ; 10

11 DrawGraph(0, 0, Open, FALSE); DrawStringToHandle( 100, 80,, GetColor(255, 255, 0), FontHG48); DrawBox(195, *start select, 510, *start select, GetColor(255, 255, 0), FALSE); DrawStringToHandle( 250, 250, PUSH RETURN, GetColor(255, 255, 255), FontHGS24); DrawGraph(200, 252, teki0[0], TRUE); DrawFormatStringToHandle(250, 275, GetColor(255, 255, 255), FontHGS24, Time : %d,time1); DrawGraph(200, 277, Apple[0], TRUE); DrawStringToHandle( 250, 300, :, GetColor(255, 255, 255), FontHGS24); DrawFormatStringToHandle(360, 300,Lv color, FontHGS24, %s,lv1); DrawGraph(200, 302, Apple[13], TRUE); while(1){ break; break RETURN if( ProcessMessage() == -1 ) break; break; while(1) DrawBox(195, *start select, 510, *start select, GetColor(255, 255, 0), FALSE); GetColor(255, 255, 0) 195, *start select 510, *start select start select y Time 11

12 4.2 if(start counter<10) start counter++; else if(key[ KEY INPUT DOWN ] == 1 ){ start counter=0; start select++; if(start select>3) start select=1; else if(key[ KEY INPUT UP ] == 1 ){ start counter=0; start select ; if(start select<1) start select=3; start counter++; start select -1 start select Time if(time counter<10) time counter++; else if(start select==1 && Key[ KEY INPUT RIGHT ] == 1 ){ time counter=0; time select++; 12

13 if(time select>7) time select=7; else if(start select==1 && Key[ KEY INPUT LEFT ] == 1 ){ time counter=0; time select ; if(time select<1) time select=1; if(time select==0) time1=10; else if(time select==1) time1=30; else if(time select==7) time1=600; time select if(lv counter 10) Lv counter++; if(lv==1){ strcpy(lv1, Very Easy ); Lv color=getcolor(0, 255, 255); if(lv==2){ strcpy(lv1, Easy ); Lv color=getcolor(0, 255, 0); 13

14 Lv essy hard strcpy(lv1, very easy ); Lv1 very easy easy Lv color Lv 2 easy : // int Maxhp0[10]= {3, 2, 5, 2, ; int attack0[10]={3, 1, 5, 2, ; int speed0[10]= {3, 3, 1, 5, ; int count0[10]= {2, 5, 1, 3, ; int 7 void GameStart(void) 14

15 else if(start select==3){ DrawStringToHandle(110, 375,, GetColor(0, 200, 255), FontHGS20); DrawStringToHandle(110, 400,, GetColor(255, 0, 50), FontHGS20); DrawStringToHandle(110, 425,, GetColor(255, 255, 0), FontHGS20); DrawStringToHandle(110, 450,, GetColor(0, 255, 0), FontHGS20); for(i=0; i Maxhp0[character]; i++) DrawStringToHandle(200+20*i, 375,, GetColor(0, 200, 255), FontHGS20); for(j=0; j attack0[character]; j++) DrawStringToHandle(200+20*j, 400,, GetColor(255, 0, 50), FontHGS20); for(k=0; k speed0[character]; k++) DrawStringToHandle(200+20*k, 425,, GetColor(255, 255, 0), FontHGS20); for(m=0; m count0[character]; m++) DrawStringToHandle(200+20*m, 450,, GetColor(0, 255, 0), FontHGS20); DrawStringToHandle for int int character 15

16 5 void tama Input(void) { if(tama counter<5) // (1) tama counter++; else if(waza select==0 && Key[ KEY INPUT SPACE ] == 1 ){ // (2) tama counter=0; shot=tamamax; for(j=0; j<shot; j++){ if(tama[j].flag==0){ tama[j].flag=1; tama[j].x=x+16; tama[j].y=y; tama[j].y2=y; tama[j].size=3; tama[j].attack=1; break; else if(waza select==1 && Key[ KEY INPUT SPACE ] == 1 ){ // (3) tama counter=5; shot=tamamax; tama Draw(); void tama Draw(void) { for(j=0; j<shot; j++){ if(tama[j].flag==1){ tama[j].y-=7; DrawRotaGraph(tama[j].x, tama[j].y, 1.5f, 0, cut[0], TRUE); tama Hantei(); 16

17 void tama Input(void) (1) if if int tama counter (2) else if Waza select==0 SPACE (3) tama counter=5 (2) tama Draw(void) SPACE Waza select SPACE Waza select==0 Waza select==2 Waza select==3 tama Draw(void) DrawRotaGraph(tama[j].x, tama[j].y, 1.5f, 0, cut[0], TRUE); cut[0] 1.5f cut[0] 1.5 tama[j].x tama[j].y x y tama[j].y-=7 7 tama Hantei(); 17

18 6 8 8: DX 9: 18

19 DrawStringToHandle( 505, 68, HP, GetColor( 255, 255, 0 ), FontHGS20) ; DrawFormatStringToHandle( 545, 80, GetColor( 255, 255, 255 ), FontHG20, % d, hp); DrawFormatStringToHandle( 575, 80, GetColor( 255, 255, 255 ), FontHG20, /% d, Maxhp) ; DrawBox(525, 70, 635, 80, GetColor(0, 0, 0), TRUE); if(hp<20) DrawBox(525, 70, *hp/Maxhp, 80, GetColor(255, 0, 0), TRUE ); else if(hp<50) DrawBox(525, 70, *hp/Maxhp, 80, GetColor(255, 255, 0), TRUE ); else DrawBox(525, 70, *hp/Maxhp, 80, GetColor(0, 225, 0), TRUE ); DrawBox(525, 70, 635, 80, GetColor(255, 255, 255), FALSE); 9 HG int FontHG20 DrawStringToHandle DrawFormatStringToHandle DrawBox GetColor() TRUE DrawBox(525, 70, *hp/Maxhp, 80, GetColor(0, 225, 0), TRUE ); (525,70) ( *hp/Maxhp,80) *hp/Maxhp hp Maxhp hp 9 if DrawBox(525, 70, 635, 80, GetColor(255, 255, 255), FALSE); FALSE GetColor() 19

20 DrawBox(502, (Waza x+20)+waza select*20, 635, (Waza x+40)+waza select*20, GetColor(255, 255, 0), FALSE); if(waza counter<10) Waza counter++; else if(key[ KEY INPUT Z ] == 1 ){ Waza counter=0; Waza select++; if(waza select>3) Waza select=0; else if(key[ KEY INPUT X ] == 1 ){ Waza select=0; DrawStringToHandle(535, 370,, GetColor(255, 255, 0), FontHG20) ; DrawGraph(505,390, Waza1[0], TRUE); for(a=1; a<wazax; a++){ DrawGraph(505,390+20*a, Waza1[a], TRUE); DrawBox(530, *a, 630, *a, GetColor(0, 0, 0), TRUE); DrawBox(530, *a, *Waza[a]/MaxWaza[a], *a, GetColor(255, 0, 255), TRUE ); DrawBox(530, *a, 630, *a, GetColor(255, 255, 255), FALSE); 10: 8 Z,X Z 20

21 C for for for for 7 21

22 8 [1] [2] [3] Microsoft Visual Studio 2008 Express Edition [4] [5] qma/education/cpro/index.html 22

23 9 #include "DxLib.h" #include <math.h> #define tamamax 500 #define StarMAX 30 #define SparkMAX 800 #define tekimax 100 #define WazaX 4 #define charax 9 #define PI // char Key[256]; struct shot{ double x, y, x2, y2; double angle, X, Y, Z; int color; int flag; int Size; int attack; int A,d; ; struct STAR{ int x, y; int flag; int apple; int hantei_x, hantei_y, range; int color; int Size; int hp, Maxhp; int mp1, mp2; int attack; int counter; int shot; int teki; ; struct TEKI{ double x, y; int i; 23

24 int flag; int Size; int attack; double angle; int counter, shot; int color; int hantei_x, hantei_y, range; ; struct SPARK{ int x, y, xflag; int flag; int Sx, Sy; int color; int i, star; int time; ; void StartData(void); void GameStart(void); void GameOver(void); void Fighter(void); void Star_Draw(void); void Star_Hantei(void); void teki_attack(void); void teki_draw(void); void teki_hantei(void); void CreateSpark(int m, int n); void MoveSpark(void); void tama_input(void); void tama_draw(void); void tama_hantei(void); void GameDate(void); struct shot tama[tamamax]; struct STAR Star[StarMAX]; struct TEKI teki[tekimax]; struct SPARK Spark[SparkMAX]; int tama_counter=50, Star_counter=20; int a, i, j, k, m, n; int x, y; int P, Q; 24

25 int shot, teki_shot; int hp, Maxhp; int attack, speed, count; int score=0, score1, hscore=0; int tekihp=1, tekimaxhp=1, tekihpflag=0; int food_count=0; double hantei_x, hantei_y, range1; double hantei_x, hantei_y, range2; int Haikei_X=-960; int teki_count=0; int RefreshTime; // int Maxhp0[10]= {3, 3, 5, 2, 3, 2, 5, 4, 3; int attack0[10]={3, 1, 5, 1, 3, 4, 3, 2, 4; int speed0[10]= {3, 3, 1, 5, 4, 2, 2, 4, 2; int count0[10]= {3, 5, 1, 4, 2, 4, 2, 2, 3; int start_select=0, start_counter=0; int time, time1, time_select=2, time_counter=0; int Lv=3, Lv_select=2, Lv_counter=0, LvA=0, LvC=0, LvHP=0, LvS=0, Lv_color; int character=0, character_counter=0; char Lv1[10]; int end_select=0, end_counter=0; int Waza[WazaX], MaxWaza[WazaX]; int Waza_select=0, Waza_counter=0, Waza_x=370; int Haikei, Open, Data, end; int MAN[32]; int cut[10]; int Apple[32], Mp[5]; int teki0[10], teki1[10], teki2, teki3, teki4, teki5; int tekia; int Waza0, Waza1[10]; int Bom,Block,Allow; int FontHGS_Spark, FontHGS16, FontHGS20, FontHGS24, FontHG16, FontHG20, FontHG24, FontHG48; // WinMain int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE hprevinstance,lpstr lpcmdline, int ncmdshow ){ ChangeWindowMode( TRUE ); // 25

26 if( DxLib_Init() == -1 ) return -1; //DX SetMainWindowText( " " ) ; FontHGS_Spark=CreateFontToHandle("HGS ", 10, 1, DX_FONTTYPE_NORMAL); FontHGS20=CreateFontToHandle("HGS ", 16, 16, DX_FONTTYPE_NORMAL); FontHGS24=CreateFontToHandle("HGS ", 24, 6, DX_FONTTYPE_NORMAL); FontHG16=CreateFontToHandle("HG ", 16, 1, DX_FONTTYPE_NORMAL); FontHG20=CreateFontToHandle("HG ", 20, 1, DX_FONTTYPE_NORMAL); FontHG24=CreateFontToHandle("HG ", 24, 1, DX_FONTTYPE_NORMAL); FontHG48=CreateFontToHandle("HG ", 48, 1, DX_FONTTYPE_NORMAL); Open=LoadGraph("PicFile\\Open.png"); end=loadgraph("picfile\\end.png"); LoadDivGraph("PicFile\\man.png", 18, 2, 9, 16, 16, MAN); Haikei=LoadGraph("PicFile\\haikei.png"); Data=LoadGraph("PicFile\\data.png"); LoadDivGraph("PicFile\\Apple.png", 16, 4, 4, 20, 20, Apple); LoadDivGraph("PicFile\\mp.png", 4, 2, 2, 20, 20, Mp); LoadDivGraph("PicFile\\teki0.png", 6, 3, 2, 20, 17, teki0); LoadDivGraph("PicFile\\teki1.png", 2, 2, 1, 16, 16, teki1); teki2=loadgraph("picfile\\teki2.png"); teki3=loadgraph("picfile\\teki3.png"); teki4=loadgraph("picfile\\teki4.png"); teki5=loadgraph("picfile\\teki5.png"); Bom=LoadGraph("PicFile\\Bom.png"); Block=LoadGraph("PicFile\\Block.png"); Allow=LoadGraph("PicFile\\Allow.png"); LoadDivGraph("PicFile\\Waza.png", 4, 2, 2, 20, 20, Waza1); LoadDivGraph("PicFile\\cut.png", 2, 2, 1, 9, 9, cut); SetDrawScreen( DX_SCREEN_BACK ) ;// GameStart(); StartData(); while(1){ RefreshTime = GetNowCount(); ClearDrawScreen(); GetHitKeyStateAll( Key ) ; // // // 26

27 if( ProcessMessage() == -1 ) break ; // DrawGraph(500, 0, Data, FALSE); DrawGraph(0, Haikei_X, Haikei, FALSE); Haikei_X+=1; if(haikei_x>0) Haikei_X=-960; Fighter(); // MoveSpark(); Star_Draw(); // tama_input(); // GameDate(); //ESC if( Key[ KEY_INPUT_ESCAPE] == 1 ) { hp=0; GameOver(); ScreenFlip() ;// while(getnowcount() - RefreshTime < 11); DxLib_End() ;// return 0 ;// // WinMain void StartData(void) { hp=maxhp; if(score1>hscore) hscore=score1; score=0; time=time1*60+60; // tekihp=1; tekimaxhp=1; tekihpflag=0; 27

28 food_count=0; teki_count=0; x=250; y=420; if(lv==4){ LvHP=1; LvA=1; if(lv==5){ LvHP=2; LvA=3; LvS=2; if(lv==6){; LvC=1; LvS=10; Maxhp=Maxhp0[character]*20+40; hp=maxhp; attack=attack0[character]; speed=speed0[character]+1; count=count0[character]-1; Haikei_X=-960; Waza_select=0; Waza_counter=0; for(i=1; i<wazax; i++){ MaxWaza[i]=1000; Waza[i]=MaxWaza[i]*0.3; for(i=0; i<tamamax; i++){ tama[i].y=450; tama[i].flag=0; for(i=0; i<tekimax; i++){ teki[i].flag=0; teki[i].y=0; 28

29 teki[i].counter=0; for(i=0; i<starmax; i++){ Star[i].flag=0; Star[i].y=0; for(i=0; i<sparkmax; i++){ Spark[i].flag=0; Spark[i].xflag=0; // void GameStart(void) { while(1){ GetHitKeyStateAll( Key ) ; // if( ProcessMessage() == -1 ) break ; // DrawGraph(0, 0, Open, FALSE); DrawStringToHandle( 100, 80, " ", GetColor(255, 255, 0), FontHG48); DrawBox(195, *start_select, 490, *start_select, GetColor(255, 255, 0), FALSE); DrawStringToHandle( 250, 250, "Game Start", GetColor(255, 255, 255), FontHGS24); DrawGraph(200, 252, teki0[0], TRUE); DrawFormatStringToHandle(250, 275, GetColor(255, 255, 255), FontHGS24, "Time : %d",time1); DrawGraph(200, 277, Apple[0], TRUE); DrawStringToHandle( 250, 300, " : ", GetColor(255, 255, 255), FontHGS24); DrawFormatStringToHandle(360, 300,Lv_color, FontHG24, "%s ",Lv1); DrawGraph(200, 302, Apple[13], TRUE); DrawStringToHandle( 250, 325, " ", GetColor(255, 255, 255), FontHGS24); DrawGraph(200, 327, teki4, TRUE); DrawGraph(430, 327, MAN[character*2], TRUE); if(start_counter<10) start_counter++; else if(key[ KEY_INPUT_DOWN ] == 1 ){ start_counter=0; 29

30 start_select++; if(start_select>3) start_select=3; else if(key[ KEY_INPUT_UP ] == 1 ){ start_counter=0; start_select--; if(start_select<0) start_select=0; if(time_counter<10) time_counter++; else if(start_select==1 && Key[ KEY_INPUT_RIGHT ] == 1 ){ time_counter=0; time_select++; if(time_select>7) time_select=7; else if(start_select==1 && Key[ KEY_INPUT_LEFT ] == 1 ){ time_counter=0; time_select--; if(time_select<1) time_select=1; if(time_select==0) time1=10; else if(time_select==1) time1=30; else if(time_select==2) time1=60; else if(time_select==3) time1=90; else if(time_select==4) time1=120; else if(time_select==5) time1=180; else if(time_select==6) time1=300; else if(time_select==7) time1=600; 30

31 if(lv_counter<10) Lv_counter++; else if(start_select==2 && Key[ KEY_INPUT_RIGHT ] == 1 ){ Lv_counter=0; Lv++; if(lv>6) Lv=6; else if(start_select==2 && Key[ KEY_INPUT_LEFT ] == 1 ){ Lv_counter=0; Lv--; if(lv<1) Lv=1; if(lv==1){ strcpy(lv1,"very Easy"); Lv_color=GetColor(0, 255, 255); if(lv==2){ strcpy(lv1,"easy"); Lv_color=GetColor(0, 255, 0); if(lv==3){ strcpy(lv1,"normal"); Lv_color=GetColor(255, 255, 0); if(lv==4){ strcpy(lv1,"hard"); Lv_color=GetColor(255, 128, 0); if(lv==5){ strcpy(lv1,"very Hard"); Lv_color=GetColor(255, 0, 0); if(lv==6){ strcpy(lv1,"high Speed"); Lv_color=GetColor(255, 100, 255); if(character_counter<10) character_counter++; else if(start_select==3 && Key[ KEY_INPUT_RIGHT ] == 1 ){ character_counter=0; 31

32 character++; if(character>charax-1) character=charax-1; else if(start_select==3 && Key[ KEY_INPUT_LEFT ] == 1 ){ character_counter=0; character--; if(character<0) character=0; DrawBox(105, 370, 535, 470, GetColor(0, 255, 0), FALSE); if(start_select==0) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==1) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==2 && Lv==1) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==2 && Lv==2) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==2 && Lv==3) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==2 && Lv==4) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==2 && Lv==5) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==2 && Lv==6) DrawStringToHandle(110, 375, " ", GetColor(255, 255, 255), FontHGS20); else if(start_select==3){ DrawStringToHandle(110, 375, " ", GetColor(0, 200, 255), FontHGS20); DrawStringToHandle(110, 400, " ", GetColor(255, 0, 50), FontHGS20); DrawStringToHandle(110, 425, " ", GetColor(255, 255, 0), FontHGS20); DrawStringToHandle(110, 450, " ", GetColor(0, 255, 0), FontHGS20); for(i=0; i<maxhp0[character]; i++) DrawStringToHandle(200+20*i, 375, " ", GetColor(0, 200, 255), FontHGS20); for(j=0; j<attack0[character]; j++) DrawStringToHandle(200+20*j, 400, " ", GetColor(255, 0, 50), FontHGS20); for(k=0; k<speed0[character]; k++) DrawStringToHandle(200+20*k, 425, " ", GetColor(255, 255, 0), FontHGS20); for(m=0; m<count0[character]; m++) 32

33 DrawStringToHandle(200+20*m, 450, " ", GetColor(0, 255, 0), FontHGS20); ScreenFlip(); if(key[ KEY_INPUT_RETURN] == 1 (start_select==0 && Key[ KEY_INPUT_SPACE] == 1 )) break; // void GameOver(void) { int Gyou=150; while(1){ GetHitKeyStateAll( Key ) ; // if( ProcessMessage() == -1 ) break ; // DrawGraph(500, 0, Data, FALSE); DrawGraph(0, Haikei_X, Haikei, FALSE); if(hp<1) DrawStringToHandle( 80, 100, " ", GetColor(255, 0, 0), FontHG48); DrawFormatStringToHandle(100, Gyou, GetColor(0, 255, 255), FontHG24, "Score %d", score); DrawFormatStringToHandle(100, Gyou+25, GetColor(255, 50, 255), FontHG24, " %d", Lv*time1*5 + food_count*100); DrawFormatStringToHandle(120, Gyou+45, GetColor(255, 255, 255), FontHG20, " %d %d = %d", Lv, time1*5, Lv*time1*5) ; DrawFormatStringToHandle(120, Gyou+65, GetColor(255,255, 255), FontHG20, " %d 100 = %d", food_count, food_count*100); score1= score + Lv*time1*5 + food_count*100; DrawLine(100, Gyou+85, 400, Gyou+85, GetColor(255,255,255), FALSE); DrawFormatStringToHandle(100, Gyou+85, GetColor(255,255,0), FontHG24, " %d", score1); 33

34 DrawStringToHandle( 100, 300, " ", GetColor(255, 255, 255), FontHG24); DrawStringToHandle( 120, 325, " Yes", GetColor(255, 255, 255), FontHG24); DrawStringToHandle( 220, 325, " No", GetColor(255, 255, 255), FontHG24); DrawBox( *end_select, 325, *end_select, 350, GetColor(255, 255, 0), FALSE); if(end_counter<10) end_counter++; else if(key[ KEY_INPUT_RIGHT ] == 1 ){ end_counter=0; end_select++; if(end_select>1) end_select=0; else if(key[ KEY_INPUT_LEFT ] == 1 ){ end_counter=0; end_select--; if(end_select<0) end_select=1; if(end_select==0 && Key[ KEY_INPUT_RETURN ] == 1 ){ StartData(); break; else if(end_select==1 && Key[ KEY_INPUT_RETURN ] == 1 ){ DxLib_End(); // exit( -1 ); // ScreenFlip(); // void Fighter(void) { // DrawRotaGraph(x+16, y+16, 2.0f, 0, MAN[character*2], TRUE); // if( Key[ KEY_INPUT_RIGHT ] == 1 ) x+=speed; if(x>=468) x=468; if( Key[ KEY_INPUT_LEFT ] == 1 ) 34

35 x-=speed; if(x<=0) x=0; if( Key[ KEY_INPUT_DOWN ] == 1 ) y+=speed; if(y>448) y=448; if( Key[ KEY_INPUT_UP ] == 1 ) y-=speed; if(y<150) y=150; // void Star_Draw(void) { if(star_counter<30-25*lvc) Star_counter++; else{ Star_counter=0; for(i=0; i<starmax; i++){ if(star[i].flag==0){ Star[i].x=10*GetRand(47)+10; P=GetRand(1000); // if(p<100){ if(lv==1) Star[i].flag=0; else Star[i].flag=2; Star[i].hp=15; Star[i].Maxhp=Star[i].hp; else if(p<150){ if(lv==1 Lv==6) Star[i].flag=0; else Star[i].flag=3; Star[i].hp=5; Star[i].Maxhp=Star[i].hp; 35

36 // else if(p<200){ if(lv<3 Lv>5) Star[i].flag=0; else Star[i].flag=GetRand(5)+4; if(teki_count<1) teki_count++; else Star[i].flag=0; Star[i].x=30*(GetRand(8)+1); // if(star[i].flag==4) Star[i].hp=50+LvHP*5; else if(star[i].flag==5) Star[i].hp=60+LvHP*5; else if(star[i].flag==6) Star[i].hp=40+LvHP*5; else if(star[i].flag==7) Star[i].hp=55+LvHP*5; else if(star[i].flag==8) Star[i].hp=42+LvHP*5; else if(star[i].flag==9) Star[i].hp=50+LvHP*5; Star[i].Maxhp=Star[i].hp; // else if(p<350){ Star[i].flag=10; Star[i].apple=GetRand(15); else if(p<450){ Star[i].flag=11; Star[i].mp1=GetRand(29); if(star[i].mp1==0) Star[i].mp2=2; else if(star[i].mp1<5) Star[i].mp2=3; else if(star[i].mp1<15) Star[i].mp2=1; 36

37 else Star[i].mp2=0; else{ Star[i].flag=1; if(lv==6) Star[i].hp=2; else Star[i].hp=10; Star[i].Maxhp=Star[i].hp; Star[i].color=GetRand(5); break; for(i=0; i<starmax; i++){ // if(star[i].flag==1){ Star[i].Size=10; Star[i].y+=1+LvS; DrawGraph(Star[i].x, Star[i].y, teki0[star[i].color], TRUE); Star_Hantei(); else if(star[i].flag==2){ Star[i].y+=1+LvS; Star[i].Size=10; DrawGraph(Star[i].x, Star[i].y, Bom, TRUE); Star_Hantei(); else if(star[i].flag==3){ Star[i].y+=5+LvS; Star[i].Size=5; DrawGraph(Star[i].x, Star[i].y, Allow, TRUE); Star_Hantei(); else if(star[i].flag==4){ if(star[i].y>100 && Star[i].hp>0) Star[i].y=100; 37

38 else Star[i].y+=1; Star[i].Size=20; DrawRotaGraph(Star[i].x+20, Star[i].y+20, 2.0f, 0, teki1[0], TRUE); Star_Hantei(); teki_attack(); else if(star[i].flag==5){ if(star[i].y>100 && Star[i].hp>0) Star[i].y=100; else Star[i].y+=1; Star[i].Size=20; DrawRotaGraph(Star[i].x+20, Star[i].y+20, 2.0f, 0, teki1[1], TRUE); Star_Hantei(); teki_attack(); else if(star[i].flag==6){ if(star[i].y>50 && Star[i].hp>0) Star[i].y=50; else Star[i].y+=2; Star[i].Size=20; Star[i].x=x; DrawRotaGraph(Star[i].x+20, Star[i].y+20, 2.0f, 0, teki2, TRUE); Star_Hantei(); teki_attack(); else if(star[i].flag==7){ if(star[i].y>100 && Star[i].hp>0) Star[i].y=100; else Star[i].y+=1; Star[i].Size=20; DrawRotaGraph(Star[i].x+20, Star[i].y+20, 2.0f, 0, teki3, TRUE); Star_Hantei(); teki_attack(); else if(star[i].flag==8){ if(star[i].y>30 && Star[i].hp>0) Star[i].y=30; else Star[i].y+=1; 38

39 Star[i].Size=20; DrawRotaGraph(Star[i].x+20, Star[i].y+20, 2.0f, 0, teki4, TRUE); Star_Hantei(); teki_attack(); else if(star[i].flag==9){ if(star[i].y>100 && Star[i].hp>0) Star[i].y=100; else Star[i].y+=1; Star[i].Size=20; DrawRotaGraph(Star[i].x+20, Star[i].y+20, 2.0f, 0, teki5, TRUE); Star_Hantei(); teki_attack(); // else if(star[i].flag==10){ Star[i].y+=1+LvS; Star[i].Size=10; DrawGraph(Star[i].x, Star[i].y, Apple[Star[i].apple], TRUE); Star_Hantei(); else if(star[i].flag==11){ Star[i].y+=1+LvS; Star[i].Size=10; DrawGraph(Star[i].x, Star[i].y, Mp[Star[i].mp2], TRUE); Star_Hantei(); // void Star_Hantei(void) { if(star[i].y>480){ Star[i].x=10*GetRand(47)+10; Star[i].y=0; Star[i].flag=0; // 39

40 hantei_x=(x+8)-star[i].x; hantei_y=(y+8)-star[i].y; range1=16+star[i].size; if( hantei_x * hantei_x + hantei_y * hantei_y < range1 * range1){ if(star[i].flag==1){ hp-=10; DrawRotaGraph(x+16, y+16, 2.0f, 0, MAN[character*2+1], TRUE); else if(star[i].flag==2){ hp-=20; DrawRotaGraph(x+16, y+16, 2.0f, 0, MAN[character*2+1], TRUE); for(int k=0; k<10; k++){ CreateSpark(x+16, y+16); else if(star[i].flag==3){ hp-=10; DrawRotaGraph(x+16, y+16, 2.0f, 0, MAN[character*2+1], TRUE); else if(star[i].flag==10){ if(star[i].apple>9) hp+=10; else hp+=5; food_count++; else if(star[i].flag==11){ if(star[i].mp2==3){ for(a=1; a<wazax; a++) Waza[a]-=MaxWaza[a]*0.2; else if(star[i].mp2==2){ for(a=1; a<wazax; a++) Waza[a]+=MaxWaza[a]*0.3; else if(star[i].mp2==1){ for(a=1; a<wazax; a++) Waza[a]+=MaxWaza[a]*0.1; else{ for(a=1; a<wazax; a++) Waza[a]+=MaxWaza[a]*0.05; 40

41 Star[i].y=490; Star[i].flag=0; if(hp>=maxhp) hp=maxhp; if(hp<=0){ hp=0; GameOver(); for(a=1; a<wazax; a++){ if(waza[a]>=maxwaza[a]) Waza[a]=MaxWaza[a]; if(waza[a]<1) Waza[a]=0; // void teki_attack(void) { if(teki[i].counter<30) teki[i].counter++; else if(star[i].flag==4){ teki[i].counter=10; teki[i].shot=tekimax; for(teki[i].i=0; teki[i].i<teki[i].shot; teki[i].i++){ if(teki[teki[i].i].flag==0){ teki[teki[i].i].flag=1; teki[teki[i].i].x=star[i].x+20; teki[teki[i].i].y=star[i].y+20; teki[teki[i].i].size=4; teki[teki[i].i].attack=3+lva; teki[teki[i].i].angle=pi/3+(pi*getrand(30)/90); break; 41

42 else if(star[i].flag==5){ teki[i].counter=20; teki[i].shot=tekimax; for(teki[i].i=0; teki[i].i<teki[i].shot; teki[i].i++){ if(teki[teki[i].i].flag==0){ teki[teki[i].i].flag=2; teki[teki[i].i].x=star[i].x+20; teki[teki[i].i].y=star[i].y+20; teki[teki[i].i].size=3; teki[teki[i].i].attack=2+lva*2; teki[teki[i].i].angle=pi/4+(pi*getrand(30)/90); break; else if(star[i].flag==6){ teki[i].counter=0; teki[i].shot=tekimax; for(teki[i].i=0; teki[i].i<teki[i].shot; teki[i].i++){ if(teki[teki[i].i].flag==0){ teki[teki[i].i].flag=3; teki[teki[i].i].x=star[i].x+20; teki[teki[i].i].y=star[i].y+20; teki[teki[i].i].size=3; teki[teki[i].i].attack=3+lva; break; else if(star[i].flag==7){ teki[i].counter=25; teki[i].shot=tekimax; for(teki[i].i=0; teki[i].i<teki[i].shot; teki[i].i++){ if(teki[teki[i].i].flag==0){ teki[teki[i].i].flag=4; teki[teki[i].i].x=star[i].x+20; teki[teki[i].i].y=star[i].y+20; teki[teki[i].i].size=4; teki[teki[i].i].attack=3+lva; teki[teki[i].i].color=255; teki[teki[i].i].angle=m*pi/6; m++; 42

43 break; else if(star[i].flag==8){ teki[i].counter=25+lva; teki[i].shot=tekimax; for(teki[i].i=0; teki[i].i<teki[i].shot; teki[i].i++){ if(teki[teki[i].i].flag==0){ teki[teki[i].i].flag=5; teki[teki[i].i].x=star[i].x+20; teki[teki[i].i].y=star[i].y+20; teki[teki[i].i].size=2; teki[teki[i].i].attack=1; teki[teki[i].i].color=255; teki[teki[i].i].angle=pi/6+(pi*getrand(120)/180); break; else if(star[i].flag==9){ teki[i].counter=25+lva; teki[i].shot=tekimax; for(teki[i].i=0; teki[i].i<teki[i].shot; teki[i].i++){ if(teki[teki[i].i].flag==0){ teki[teki[i].i].flag=6; teki[teki[i].i].x=star[i].x+20; teki[teki[i].i].y=star[i].y+20; teki[teki[i].i].size=2; teki[teki[i].i].attack=1; teki[teki[i].i].angle=pi/3+(pi*getrand(30)/90); break; teki_draw(); // void teki_draw(void) { for(teki[i].i=0; teki[i].i<teki[i].shot; teki[i].i++){ 43

44 if(teki[teki[i].i].flag==1){ teki[teki[i].i].x+=cos(teki[teki[i].i].angle)*4; teki[teki[i].i].y+=sin(teki[teki[i].i].angle)*4; DrawCircle( teki[teki[i].i].x, teki[teki[i].i].y, teki[teki[i].i].size, GetColor(0,50,0),TRUE ); teki_hantei(); else if(teki[teki[i].i].flag==2){ teki[teki[i].i].x+=cos(teki[teki[i].i].angle)*6; teki[teki[i].i].y+=sin(teki[teki[i].i].angle)*6; DrawCircle( teki[teki[i].i].x, teki[teki[i].i].y, teki[teki[i].i].size, GetColor(128,0,255),TRUE ); teki_hantei(); else if(teki[teki[i].i].flag==3){ teki[teki[i].i].y+=5; DrawCircle( teki[teki[i].i].x, teki[teki[i].i].y, teki[teki[i].i].size, GetColor(255,255,0),TRUE ); teki_hantei(); else if(teki[teki[i].i].flag==4){ teki[teki[i].i].x+=cos(teki[teki[i].i].angle)*2; teki[teki[i].i].y+=sin(teki[teki[i].i].angle)*2; teki[teki[i].i].color-=3; if(teki[teki[i].i].color<0) teki[teki[i].i].color=0; DrawCircle( teki[teki[i].i].x, teki[teki[i].i].y, teki[teki[i].i].size, GetColor(255,teki[teki[i].i].color,0),TRUE ); teki_hantei(); else if(teki[teki[i].i].flag==5){ teki[teki[i].i].x+=cos(teki[teki[i].i].angle)*2; teki[teki[i].i].y+=sin(teki[teki[i].i].angle)*2; teki[teki[i].i].color--; if(teki[teki[i].i].color<0) teki[teki[i].i].color=0; DrawCircle( teki[teki[i].i].x, teki[teki[i].i].y, teki[teki[i].i].size, GetColor(0,teki[teki[i].i].color,255),TRUE ); teki_hantei(); if(teki[teki[i].i].flag==6){ teki[teki[i].i].x+=cos(teki[teki[i].i].angle)*7; 44

45 teki[teki[i].i].y+=sin(teki[teki[i].i].angle)*7; DrawCircle( teki[teki[i].i].x, teki[teki[i].i].y, teki[teki[i].i].size, GetColor(0,0,0), TRUE ); teki_hantei(); // void teki_hantei(void) { if(teki[teki[i].i].x<0 teki[teki[i].i].x>490 teki[teki[i].i].y<0 teki[teki[i].i].y>500 Star[i].hp<1){ teki[teki[i].i].y=500; teki[teki[i].i].flag=0; teki[teki[i].i].hantei_x=(x+16)-teki[teki[i].i].x; teki[teki[i].i].hantei_y=(y+16)-teki[teki[i].i].y; teki[teki[i].i].range=16+teki[teki[i].i].size; if(teki[teki[i].i].hantei_x * teki[teki[i].i].hantei_x + teki[teki[i].i].hantei_y * teki[teki[i].i].hantei_y <= teki[teki[i].i].range * teki[teki[i].i].range){ hp-=teki[teki[i].i].attack; DrawRotaGraph(x+16, y+16, 2.0f, 0, MAN[character*2+1], TRUE); teki[teki[i].i].y=500; teki[teki[i].i].flag=0; if(hp<=0){ hp=0; GameOver(); // void tama_input(void) { if(tama_counter<25) tama_counter++; else if(waza_select==0 && Key[ KEY_INPUT_SPACE ] == 1 ){ 45

46 tama_counter=count*5; shot=tamamax; for(j=0; j<shot; j++){ if(tama[j].flag==0){ tama[j].flag=1; tama[j].x=x+16; tama[j].y=y; tama[j].y2=y; tama[j].size=3; tama[j].attack=attack; break; else if(waza_select==1 && Key[ KEY_INPUT_SPACE ] == 1 ){ tama_counter=count*5; shot=tamamax; for(j=0; j<shot; j++){ if(waza[waza_select]<20){ break; else if(tama[j].flag==0){ tama[j].flag=2; tama[j].x=x+16; tama[j].y=y; tama[j].y2=y; tama[j].size=3; tama[j].attack=attack*2; Waza[Waza_select]-=20; break; else if(waza_select==2 && Key[ KEY_INPUT_SPACE ] == 1 ){ tama_counter=25; shot=tamamax; for(j=0; j<shot; j++){ if(waza[waza_select]<2){ break; else if(tama[j].flag==0){ 46

47 tama[j].flag=3; tama[j].x=x+16; tama[j].y=y; tama[j].y2=y; tama[j].size=5; tama[j].attack=1; tama[j].color=255; tama[j].angle=-(5*pi/12+(pi*getrand(30)/180)); tama[j].d=getrand(150)+50; Waza[Waza_select]-=2; break; else if(waza_select==3 && Key[ KEY_INPUT_SPACE ] == 1 ){ tama_counter=25; shot=tamamax; for(j=0; j<shot; j++){ if(waza[waza_select]<2){ break; else if(tama[j].flag==0){ tama[j].flag=4; tama[j].x=x+16; tama[j].x2=x+16; tama[j].y=y+16; tama[j].y2=y+16; tama[j].size=2; tama[j].attack=5; tama[j].color=255; tama[j].angle=-n*pi/4; Waza[Waza_select]-=2; n++; break; tama_draw(); 47

48 // void tama_draw(void) { for(j=0; j<shot; j++){ if(tama[j].flag==1){ tama[j].y-=6; DrawRotaGraph(tama[j].x, tama[j].y, 1.5f, 0, cut[0], TRUE); tama_hantei(); else if(tama[j].flag==2){ tama[j].y-=12; DrawRotaGraph(tama[j].x, tama[j].y, 1.5f, 0, cut[1], TRUE); tama_hantei(); else if(tama[j].flag==3){ tama[j].x+=cos(tama[j].angle)*3; tama[j].y+=sin(tama[j].angle)*3; tama[j].color-=12; if(tama[j].color<0) tama[j].color=0; DrawCircle( tama[j].x, tama[j].y, tama[j].size, GetColor(255,tama[j].color,0),TRUE ); tama_hantei(); else if(tama[j].flag==4){ tama[j].x+=cos(tama[j].angle)*3; tama[j].y+=sin(tama[j].angle)*3; tama[j].color-=5; if(tama[j].color<0) tama[j].color=0; DrawCircle( tama[j].x, tama[j].y, tama[j].size, GetColor(0,tama[j].color,255),TRUE ); tama_hantei(); // void tama_hantei(void) { for(i=0; i<starmax; i++){ Star[i].hantei_x=tama[j].x - (Star[i].x+Star[i].Size); Star[i].hantei_y=tama[j].y - (Star[i].y+Star[i].Size); Star[i].range=Star[i].Size + tama[j].size; 48

49 // if( (Star[i].hantei_x * Star[i].hantei_x + Star[i].hantei_y * Star[i].hantei_y <= Star[i].range * Star[i].range) && Star[i].flag<10){ Star[i].hp-=tama[j].attack; tekimaxhp=star[i].maxhp; tekihp=star[i].hp; tekihpflag=1; if(tekimaxhp<1) tekimaxhp=1; if(tekihp<0) tekihp=0; if(star[i].hp<=0){ if(star[i].flag==1){ score+=50; Spark[j].star=3; if(star[i].flag==2){ score+=100; Spark[j].star=5; if(star[i].flag==3){ score+=100; Spark[j].star=3; if(star[i].flag>3){ score+=300; teki_count--; Spark[j].star=5; for(spark[j].i=0; Spark[j].i<Spark[j].star; Spark[j].i++){ CreateSpark(tama[j].x, tama[j].y); tama[j].y=y; tama[j].flag=0; Star[i].y=490; 49

50 else{ tama[j].y=y; tama[j].flag=0; if( (tama[j].flag==1 && tama[j].y<tama[j].y2-150) (tama[j].flag==2 && tama[j].y<0) (tama[j].flag==3 && tama[j].y<tama[j].y2-tama[j].d) (tama[j].flag==4 && (tama[j].x<tama[j].x2-100 tama[j].x>tama[j].x2+100 tama[j].y<tama[j].y2-100 tama[j].y>tama[j].y2+100)) tama[j].x>500-tama[i].size){ tama[j].y=y; tama[j].flag=0; // void GameDate(void) { DrawLine(500,0,500,480,GetColor(255,255,255),FALSE); // time--; DrawFormatStringToHandle(510, 0, GetColor(255,255,255 ), FontHG20, "time %d", time/60); if(time/60<=0) GameOver(); // DrawFormatStringToHandle(510,30, GetColor(255,255,255 ), FontHG20, "Score %d", score); // DrawStringToHandle( 505, 68, "HP", GetColor( 255, 255, 0 ), FontHGS20) ; DrawFormatStringToHandle( 545, 80, GetColor( 255, 255, 255 ), FontHG20, "%d", hp); DrawFormatStringToHandle( 575, 80, GetColor( 255, 255, 255 ), FontHG20, "/%d", Maxhp) ; DrawBox(525, 70, 635, 80, GetColor(0, 0, 0), TRUE); if(hp<0.2*maxhp) DrawBox(525, 70, *hp/Maxhp, 80, GetColor(255, 0, 0), TRUE ); else if(hp<0.5*maxhp) 50

51 DrawBox(525, 70, *hp/Maxhp, 80, GetColor(255, 255, 0), TRUE ); else DrawBox(525, 70, *hp/Maxhp, 80, GetColor(0, 225, 0), TRUE ); DrawBox(525, 70, 635, 80, GetColor(255, 255, 255), FALSE); // DrawGraph(502,105, teki0[0], TRUE); if(tekihpflag==1){ DrawFormatStringToHandle( 555, 120, GetColor( 255, 255, 255 ), FontHG20, "%d", tekihp); DrawFormatStringToHandle( 575, 120, GetColor( 255, 255, 255 ), FontHG20, "/%d", tekimaxhp); DrawBox(525, 110, 635, 120, GetColor(0, 0, 0), TRUE); if(tekihp<=tekimaxhp*0.2) DrawBox(525, 110, *tekiHP/tekiMAXHP, 120, GetColor(255, 0, 0), TRUE ); else if(tekihp<=tekimaxhp*0.5) DrawBox(525, 110, *tekiHP/tekiMAXHP, 120, GetColor(255, 255, 0), TRUE ); else DrawBox(525, 110, *tekiHP/tekiMAXHP, 120, GetColor(0, 128, 255), TRUE ); DrawBox(525, 110, 635, 120, GetColor(255, 255, 255), FALSE); DrawLine(500, 160, 640, 160, GetColor(255,255,255), FALSE); DrawStringToHandle( 525, 160, " ", GetColor( 255, 255, 0), FontHG20); DrawStringToHandle( 505, 185, " : ", GetColor( 255, 255, 255), FontHG16); DrawStringToHandle( 505, 205, " :SPACE ", GetColor( 255, 255, 255), FontHG16); DrawStringToHandle( 505, 225, " :Z,C ", GetColor( 255, 255, 255), FontHG16); DrawStringToHandle( 505, 245, " :Esc ", GetColor( 255, 255, 255), FontHG16); DrawLine(500, 275, 640, 275, GetColor(255,255,255), FALSE); DrawStringToHandle( 525, 275, " ", GetColor( 255, 255, 0 ), FontHG20) ; DrawFormatStringToHandle( 510, 300, GetColor( 255, 255, 255 ), FontHG16, " %d", time1); DrawStringToHandle( 510, 320, "Lv", GetColor( 255, 255, 255), FontHG16) ; DrawFormatStringToHandle( 535, 320, Lv_color, FontHG16, "%s", Lv1); DrawFormatStringToHandle( 510, 340, GetColor( 255, 255, 255 ), FontHG16, "HighScore %d", hscore); DrawLine(500, Waza_x, 640, Waza_x, GetColor(255,255,255), FALSE); DrawBox(502, (Waza_x+20)+Waza_select*20, 635, (Waza_x+40)+Waza_select*20, GetColor(255, 255, 0) FALSE); if(waza_counter<10) Waza_counter++; 51

52 else if(key[ KEY_INPUT_Z ] == 1 ){ Waza_counter=0; Waza_select++; if(waza_select>3) Waza_select=0; else if(key[ KEY_INPUT_X ] == 1 ){ Waza_select=0; DrawStringToHandle( 535, Waza_x, " ", GetColor( 255, 255, 0 ), FontHG20) ; DrawGraph(505,Waza_x+20, Waza1[0], TRUE); for(a=1; a<wazax; a++){ DrawGraph(505,(Waza_x+20)+20*a, Waza1[a], TRUE); DrawBox(530, (Waza_x+25)+20*a, 630, (Waza_x+35)+20*a, GetColor(0, 0, 0), TRUE); DrawBox(530, (Waza_x+25)+20*a, *Waza[a]/MaxWaza[a], (Waza_x+35)+20*a, GetColor(255, 0, 255), TRUE ); DrawBox(530, (Waza_x+25)+20*a, 630, (Waza_x+35)+20*a, GetColor(255, 255, 255), FALSE); // void CreateSpark(int m, int n) { for(k=0; k<sparkmax; k++){ if(spark[k].flag==0) break; if(k!= SparkMAX){ Spark[k].x=m*100; Spark[k].y=n*100; Spark[k].Sx=GetRand(600)-300; Spark[k].Sy=-GetRand(200); Spark[k].time=GetRand(150)+50; Spark[k].color=GetRand(4); if(spark[k].color==0) Spark[k].color=GetColor(255,255,0); else if(spark[k].color==1) Spark[k].color=GetColor(0,255,255); else if(spark[k].color==2) 52

53 Spark[k].color=GetColor(255,100,255); else if(spark[k].color==3) Spark[k].color=GetColor(255,150,0); else if(spark[k].color==4) Spark[k].color=GetColor(0,255,0); Spark[k].flag=1; // void MoveSpark(void) { for(k=0; k<sparkmax; k++){ if(spark[k].flag==0) continue; Spark[k].y+=Spark[k].Sy; if(spark[k].xflag==0) Spark[k].x+=Spark[k].Sx; else if(spark[k].xflag==1) Spark[k].x-=Spark[k].Sx; Spark[k].Sy+=3; Spark[k].time--; if(spark[k].time<0){ Spark[k].flag=0; Spark[k].xflag=0; if(spark[k].x<0 Spark[k].x/100>490) Spark[k].xflag=1; for(k=0; k<sparkmax; k++){ if(spark[k].flag==1){ DrawStringToHandle(Spark[k].x/100, Spark[k].y/100, " ", Spark[k].color, FontHGS_Spark); 53

2009 T060050

2009 T060050 T060050 C++ Microsoft Visual C++ 2008 Express Edition DX C DX VC++ Debug exe 1 2 2009 T060050 1 1 2 1 2.1...................... 1 2.2....................... 2 3 3 3.1................... 3 3.2.....................

More information

Microsoft Word - DxLib_9_4.doc

Microsoft Word - DxLib_9_4.doc DX ライブラリ講座 1 DX ライブラリとは DX ライブラリはただはただプログラマープログラマーの方々が絵を画面画面に表示表示することやすることや 効果音効果音を鳴らすためだけに膨大膨大な労力労力を費やさずにすむためにやさずにすむために存在存在するするライブラリライブラリなのですなのです (DX ライブラリの本家サイト ( 以下サイトと書きます ) どこまで出来るDXライブラリ のページより抜粋)

More information

ソフトゼミA 2015 第0回

ソフトゼミA 2015 第0回 ソフトゼミ B 2016 第 6 回 プレイヤーの移動と重力 前回までのシューティングゲームの概要は理解できたでしょうか? 今回からアクションゲームの製作に入っていきます. アクションでは新たに 重力 と ブロック判定( 壁判定 ) という要素が入ってきます. 今回はそのうちの 重力 について解説していきます. わからないところがあったら気軽に質問してください. まずは新しいプロジェクト action

More information

ソフトゼミ B 第 2 回画像処理 はじめに第二回ではゲームを作る上で基本となる 画像描写や文字描写を学んでいきます また ゲームの基礎の基礎であるゲームループを作り WaitKey で待つだけでない しっかりとしたゲームの流れを作れるように学んでいきます 画像ファイルの読み込みの準備まずは win

ソフトゼミ B 第 2 回画像処理 はじめに第二回ではゲームを作る上で基本となる 画像描写や文字描写を学んでいきます また ゲームの基礎の基礎であるゲームループを作り WaitKey で待つだけでない しっかりとしたゲームの流れを作れるように学んでいきます 画像ファイルの読み込みの準備まずは win ソフトゼミ B 第 2 回画像処理 はじめに第二回ではゲームを作る上で基本となる 画像描写や文字描写を学んでいきます また ゲームの基礎の基礎であるゲームループを作り WaitKey で待つだけでない しっかりとしたゲームの流れを作れるように学んでいきます 画像ファイルの読み込みの準備まずは windows 上で画像ファイルをプログラムに読み込ませる位置に配置します 自機 (player.png)

More information

ソフトゼミA 2015 第0回

ソフトゼミA 2015 第0回 ソフトゼミ B 2016 第 7 回 ブロック判定 今回はブロック判定です. 壁判定ということもあります.1 番のポイントは 上 下のブロック判定と, 左右のブロック判定を分けて考える ことです. どうい うことか. 順を追ってしっかりと理解していきましょう φ(* * ) = 今回もまた, 新しいソースコードを配ります. 新しいプロジェクトは作らなくていいので, ソースコードを前回作った main.cpp

More information

ソフトゼミA 2015 第0回

ソフトゼミA 2015 第0回 ソフトゼミ B 2015 第 2 回 画像処理と移動 1. はじめにソフトゼミ B 第二回では画像の描画と自機及び敵機の動きについて学びます また 全体の構成を把握するためのループ部分も作成します シューテイング ゲームの基礎となるところなので頑張っていきましょう 2. 画像及びソースコードの準備ゲーム作りのために必要な画像及びソースコードを配布します 1. (define.h)(struct.h)(global.h)(initialize.cpp)(move.cpp)(create.cpp)(update.

More information

ソフトゼミ B 第 1 回 VisualC++ DX ライブラリの導入 はじめにゼミ B では ゼミ A で学んだ C 言語の基礎を土台に Microsoft Visual C Express Edition( 以下 VisualC++, VC++) の使い方と DX ライブラリ とい

ソフトゼミ B 第 1 回 VisualC++ DX ライブラリの導入 はじめにゼミ B では ゼミ A で学んだ C 言語の基礎を土台に Microsoft Visual C Express Edition( 以下 VisualC++, VC++) の使い方と DX ライブラリ とい ソフトゼミ B 第 1 回 VisualC++ DX ライブラリの導入 はじめにゼミ B では ゼミ A で学んだ C 言語の基礎を土台に Microsoft Visual C++ 2010 Express Edition( 以下 VisualC++, VC++) の使い方と DX ライブラリ というゲームの作成を強力にサポートしてくれるプログラム群の使い方を学んでゆきます なお VC++ と DX

More information

メンバ変数とインスタンス

メンバ変数とインスタンス 第 1 章まずはメニューを表示しよう 実習編第一回ということで今後ゲームを 作っていく準備をします あと ソースを書いていくよー 第 1 章まずはメニューを表示しよう 1 プロジェクトの作成 ゲームを作成するにはとりあえずプロジェクトを作らないとね ゲームプログラミング講習 0.2. プロジェクトの準備 を参考にプロジェクトを準備しよう ファイル名は半角英数をお勧めします 必要な画像ファイルをダウンロードしよう

More information

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

2008 DS T050049

2008 DS T050049 DS T050049. PSP DS DS DS RPG DS OS Windows XP DevkiPro OS DS CPU ARM devkitarm MSYS MinGW MSYS MinGW Unix OS C++ C++ make nds nds DS DS micro SD Card nds DS DS DS nds C Java C++ nds nds DS 2008 DS T050049

More information

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

More information

C# ++ MASA C# ( ) XNA 1.1 C# ( ) VisualStuio XNA 4.0 VisualStuio XNA 3.1 * * *3 2.1 VisualStuio Windows ( TextGam

C# ++ MASA C# ( ) XNA 1.1 C# ( ) VisualStuio XNA 4.0 VisualStuio XNA 3.1 * * *3 2.1 VisualStuio Windows ( TextGam C# ++ MASA 2011 8 1 C# ( ) XNA 1.1 C# ( ) VisualStuio 2010 + XNA 4.0 VisualStuio 2008 + XNA 3.1 *1 1.2 1 *2 1.3 2 *3 2.1 VisualStuio Windows ( TextGame2 ) OK *1 XNA 3.1 4.0 *2 *3 1 TextGame2 ( Ship ) 32*32

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

joho09.ppt

joho09.ppt s M B e E s: (+ or -) M: B: (=2) e: E: ax 2 + bx + c = 0 y = ax 2 + bx + c x a, b y +/- [a, b] a, b y (a+b) / 2 1-2 1-3 x 1 A a, b y 1. 2. a, b 3. for Loop (b-a)/ 4. y=a*x*x + b*x + c 5. y==0.0 y (y2)

More information

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h> 2007 12 5 1 2 2.1 ( ) 1 1: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 #define H WIN 400 // 8 #define W WIN 300 // 9

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

Windows (L): D:\jyugyou\ D:\jyugyou\ D:\jyugyou\ (N): en2 OK 2

Windows (L): D:\jyugyou\ D:\jyugyou\ D:\jyugyou\ (N): en2 OK 2 Windows C++ Microsoft Visual Studio 2010 C++ Microsoft C++ Microsoft Visual Studio 2010 Microsoft Visual Studio 2010 C++ C C++ Microsoft Visual Studio 2010 Professional Professional 1 Professional Professional

More information

pptx

pptx iphone 2010 8 18 C xkozima@myu.ac.jp C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.  このサンプルページの内容は, 新装版 1 刷発行時のものです. C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009383 このサンプルページの内容は, 新装版 1 刷発行時のものです. i 2 22 2 13 ( ) 2 (1) ANSI (2) 2 (3) Web http://www.morikita.co.jp/books/mid/009383

More information

XMPによる並列化実装2

XMPによる並列化実装2 2 3 C Fortran Exercise 1 Exercise 2 Serial init.c init.f90 XMP xmp_init.c xmp_init.f90 Serial laplace.c laplace.f90 XMP xmp_laplace.c xmp_laplace.f90 #include int a[10]; program init integer

More information

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

main

main 14 1. 12 5 main 1.23 3 1.230000 3 1.860867 1 2. 1988 1925 1911 1867 void JPcalendar(int x) 1987 1 64 1 1 1 while(1) Ctrl C void JPcalendar(int x){ if (x > 1988) printf(" %d %d \n", x, x-1988); else if(x

More information

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

8 / 0 1 i++ i 1 i-- i C !!! C 2

8 / 0 1 i++ i 1 i-- i C !!! C 2 C 2006 5 2 printf() 1 [1] 5 8 C 5 ( ) 6 (auto) (static) 7 (=) 1 8 / 0 1 i++ i 1 i-- i 1 2 2.1 C 4 5 3 13!!! C 2 2.2 C ( ) 4 1 HTML はじめ mkdir work 作業用ディレクトリーの作成 emacs hoge.c& エディターによりソースプログラム作成 gcc -o fuga

More information

r11.dvi

r11.dvi 19 11 ( ) 2019.4.20 1 / 1.1 ( n n O(n 2 O(n 2 ) ( 1 d n 1 n logn O(nlogn n ( n logn C 1.2 ( ( merge 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge int *ivec_new(int size) { int *a = (int*)malloc((size+1)

More information

ohp11.dvi

ohp11.dvi 19 11 ( ) 2019.4.20 1 / ( ) n O(n 2 ) O(n 2 ) ( ) 1 d n 1 n logn O(nlogn) n ( n logn C ) 2 ( ) ( merge) 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge 3 ( ) (2) int *ivec_new(int size) { int *a

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç C (3) if else switch AND && OR (NOT)! 1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 1 BMI BMI BMI = 10

More information

Microsoft Word - no206.docx

Microsoft Word - no206.docx 3.2 双方向リスト 今までのリストは 前から順にたどることしかできませんでした 今度は逆にもたどることができる 双方向リストを扱います この場合は 構造体には次を表すポインタの他に前を表すポインタを持つ ことになります 今回は最初と最後をポインタを使うと取り扱いが面倒になるので 最初 (start) と最後 (end) を どちらとも構造体 ( 値は意味を持たない ) を使うことにします こうすることによって

More information

課題

課題 int starttime_msec; boolean counting = false; size(400,200); smooth(); //font は各自のものに変更してください font = loadfont("serif-48.vlw"); void mouseclicked(){ counting = true; starttime_msec = millis(); int t=0;

More information

file:///D|/C言語の擬似クラス.txt

file:///D|/C言語の擬似クラス.txt 愛知障害者職業能力開発校 システム設計科 修了研究発表会報告書 題名 : C 言語の擬似クラス あらまし : C 言語でクラスを作れるという噂の真偽を確かめるために思考錯誤した まえがき : VC++ や Java その他オブジェクト指向の言語にはクラスが存在して クラスはオブジェクトの設計図である 手法 : C++ のクラスを解析して C++ のクラスを作成して C 言語に翻訳する class struct

More information

課題

課題 float xball;// 円の中心の X 座標 float yball; // 円の中心の Y 座標 float rball; // 円の半径 color cball; // 円の色 // 円を移動させる void updateball(){ yball -= 1; if(yball+rball< 0){ yball = height+rball; // 円を描く void drawball(){

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

課題

課題 size(300,120); void drawrect(float x,float y,float w,float h,color c){ rectmode(corner); stroke( (a) ); fill( (b) ); rect( (c), (d), (e), (f) ); float x = map(hour(), (g), (h), (i), (j) ); drawrect(0,0,x,height/3,color(

More information

201908計算

201908計算 立命館大学大学院 2018 年度実施入学試験 博士課程前期課程 情報理工学研究科情報理工学専攻 入試方式コース実施月 ページ 専門科目 備考 一般入学試験 8 月 P.1~ 2 月 P.16~ 社会人入学試験 8 月 2 月 外国人留学生入学試験 ( 日本語基準 ) 計算機科学 7 月 (2018 年 9 月入学 ) 8 月 2 月 学内進学入学試験 7 月 (2018 年 9 月入学 ) 7 月

More information

関数のグラフを描こう

関数のグラフを描こう L05(2010-05-07) 1 2 hig3.net ( ) L05(2010-05-07) 1 / 16 #i n c l u d e double f ( double x ) ; i n t main ( void ){ i n t n ; i n t nmax=10; double x ; double s =0.0; } x = 1.0; s=s+x ;

More information

programmingII2019-v01

programmingII2019-v01 II 2019 2Q A 6/11 6/18 6/25 7/2 7/9 7/16 7/23 B 6/12 6/19 6/24 7/3 7/10 7/17 7/24 x = 0 dv(t) dt = g Z t2 t 1 dv(t) dt dt = Z t2 t 1 gdt g v(t 2 ) = v(t 1 ) + g(t 2 t 1 ) v v(t) x g(t 2 t 1 ) t 1 t 2

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

More information

1 1 2 2 2.1 Java......... 2 2.2................................. 3 2.3.................................. 3 3 4 3.1....................................

1 1 2 2 2.1 Java......... 2 2.2................................. 3 2.3.................................. 3 3 4 3.1.................................... 06H082 1 1 2 2 2.1 Java......... 2 2.2................................. 3 2.3.................................. 3 3 4 3.1..................................... 4 3.2 GP.....................................

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

Taro-リストⅢ(公開版).jtd

Taro-リストⅢ(公開版).jtd リスト Ⅲ 0. 目次 2. 基本的な操作 2. 1 リストから要素の削除 2. 2 リストの複写 2. 3 リストの連結 2. 4 問題 問題 1 問題 2-1 - 2. 基本的な操作 2. 1 リストから要素の削除 まず 一般的な処理を書き つぎに 特別な処理を書く 一般的な処理は 処理 1 : リスト中に 削除するデータを見つけ 削除する場合への対応 特別な処理は 処理 2 : 先頭のデータを削除する場合への対応

More information

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1 6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = t 44.1 khz t = 1 sec 44100 j t f j {f 0, f 1, f 2,, f 1 6.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1, 2,,

More information

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

More information

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

(search: ) [1] ( ) 2 (linear search) (sequential search) 1 2005 11 14 1 1.1 2 1.2 (search:) [1] () 2 (linear search) (sequential search) 1 2.1 2.1.1 List 2-1(p.37) 1 1 13 n

More information

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf(hello World!!\n); return 0; 戻り値 1: main() 2.2 C main C 2007 5 29 C 1 11 2 2.1 main() 1 FORTRAN C main() main main() main() 1 return 1 1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return

More information

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO Handy Graphic for Handy Graphic Version 0.5 2008-06-09 1 Handy Graphic Handy Graphic C Handy Graphic Handy Graphic Mac OS X Handy Graphic HgDisplayer Handy Graphic HgDisplayer 2 Handy Graphic 1 Handy Graphic

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 +

p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 + 7 7.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave T > 0 t 44.1 khz t = 1 44100 j t f j {f 0, f 1, f 2,, f 1 = T t 7.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1,

More information

DA13

DA13 データ構造とアルゴリズム第 13 回 知能情報学メジャー 和 俊和 5 整列 5.1 整列とは 5.2 単純な整列アルゴリズム 5.3 挿 ソートとその拡張 5.4 ヒープソート 5.5 クイックソート 5.6 マージソート 5.7 値の 較を いない整列 5.6 マージソート 1 与えられたデータ A を A " と A # にほぼ 等分する. 2A " と A # を整列する. このとき, データ数が

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

Excel97関数編

Excel97関数編 Excel97 SUM Microsoft Excel 97... 1... 1... 1... 2... 3... 3... 4... 5... 6... 6... 7 SUM... 8... 11 Microsoft Excel 97 AVERAGE MIN MAX SUM IF 2 RANK TODAY ROUND COUNT INT VLOOKUP 1/15 Excel A B C A B

More information

Microsoft Word - no15.docx

Microsoft Word - no15.docx 7. ファイルいままでは プログラムを実行したとき その結果を画面で確認していました 簡単なものならそれでもいいのですか 複雑な結果は画面で見るだけでなく ファイルに保存できればよいでしょう ここでは このファイルについて説明します 使う関数のプロトタイプは次のとおりです FILE *fopen(const char *filename, const char *mode); ファイルを読み書きできるようにする

More information

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1 () 2006 2 27 1 10 23 () 30 () 27 [1] p.97252 7 2 2.1 2.1.1 1 LIFO(last in first out, ) (push) (pup) 1 1: 2.1.2 1 List 4-1(p.100) stack[] stack top 1 2 (push) (pop) 1 2 void stack push(double val) val stack

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

devkitpro msys

devkitpro msys 2009 RPG T050017 1 1 2 1 2.1 devkitpro msys....................... 1 2.2................................. 2 2.3......................... 2 2.4........... 2 3 3 3.1........................... 3 3.1.1.............................

More information

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

1 4 2 EP) (EP) (EP)

1 4 2 EP) (EP) (EP) 2003 2004 2 27 1 1 4 2 EP) 5 3 6 3.1.............................. 6 3.2.............................. 6 3.3 (EP)............... 7 4 8 4.1 (EP).................... 8 4.1.1.................... 18 5 (EP)

More information

8 if switch for while do while 2

8 if switch for while do while 2 (Basic Theory of Information Processing) ( ) if for while break continue 1 8 if switch for while do while 2 8.1 if (p.52) 8.1.1 if 1 if ( ) 2; 3 1 true 2 3 false 2 3 3 8.1.2 if-else (p.54) if ( ) 1; else

More information

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2  2 B R b I 4 003 4 30 1 ASCII ( ) 0 17 0 NUL 16 DLE SP 0 @ P 3 48 64 80 96 11 p 1 SOH 17 DC1! 1 A Q a 33 49 65 81 97 113 q STX 18 DC " B R b 34 50 66 8 98 114 r 3 ETX 19 DC3 # 3 C S c 35 51 67 83 99 115 s 4 EOT

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include<stdio

17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include<stdio 17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include typedef struct Potter{ Potter; int main(void){

More information

fuga scanf("%lf%*c",&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数 scanf( %d%*c,&hoge); キーボードから取り込め という命令 1: scanf 1 1: int double scanf %d %lf printf

fuga scanf(%lf%*c,&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数 scanf( %d%*c,&hoge); キーボードから取り込め という命令 1: scanf 1 1: int double scanf %d %lf printf C 2007 5 16 9 1 9 9 if else for 2 hoge scanf("%d%*c",&hoge); ( 1 ) scanf 1 %d 10 2 %*c (p.337) [Enter] &hoge hoge 1 2 10 decimal number d 1 fuga scanf("%lf%*c",&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数

More information

1.3 ( ) ( ) C

1.3 ( ) ( ) C 1 1.1 (Data Base) (Container) C++ Java 1.2 1 1.3 ( ) ( ) 1. 2. 3. C++ 2 2.1 2.2 2.3 2 C Fortran C++ Java 3 3.1 (Vector) 1. 2. ( ) 3.2 3 3.3 C++ C++ STL C++ (Template) vector vector< > ; int arrayint vector

More information

講習No.12

講習No.12 前回までの関数のまとめ 関数は main() 関数または他の関数から呼び出されて実行される. 関数を呼び出す側の実引数の値が関数内の仮引数 ( 変数 ) にコピーされる. 関数内で定義した変数は, 関数の外からは用いることができない ( ローカル変数 ). 一般に関数内で仮引数を変化しても, 呼び出し側の変数は変化しない ( 値渡し ). 関数内で求めた値は return 文によって関数値として呼び出し側に戻される.

More information

DA100データアクイジションユニット通信インタフェースユーザーズマニュアル

DA100データアクイジションユニット通信インタフェースユーザーズマニュアル Instruction Manual Disk No. RE01 6th Edition: November 1999 (YK) All Rights Reserved, Copyright 1996 Yokogawa Electric Corporation 801234567 9 ABCDEF 1 2 3 4 1 2 3 4 1 2 3 4 1 2

More information

Microsoft Word - no12.doc

Microsoft Word - no12.doc 7.5 ポインタと構造体 構造体もメモリのどこかに値が格納されているのですから 構造体へのポインタ も存在します また ポインタも変数ですから 構造体のメンバに含めることができます まずは 構造体へのポインタをあつかってみます ex53.c /* 成績表 */ #define IDLENGTH 7 /* 学籍番号の長さ */ #define MAX 100 /* 最大人数 */ /* 成績管理用の構造体の定義

More information

P06.ppt

P06.ppt p.130 p.198 p.208 2 1 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i < NUM; i++ ) if ( weight[i] > max ) max = weight[i]: if ( weight[i] < min ) min = weight[i]: weight 3 maxof(a,

More information

Microsoft Word - SU1204教本(Driver)原稿.docx

Microsoft Word - SU1204教本(Driver)原稿.docx void setup(){ pinmode(13, OUTPUT); //13 void loop(){ digitalwrite(13, HIGH); //13 HIGH delay(500); digitalwrite(13, LOW); //13 LOW delay(500); setup pinmode loop delay C M B void setup(){ pinmode(12,output);

More information

2017 p vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = 0 (79) J s flux (67) J (79) J( r, t) = k δf δs s( r,

2017 p vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = 0 (79) J s flux (67) J (79) J( r, t) = k δf δs s( r, 27 p. 47 7 7. vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = (79) J s flux (67) J (79) J( r, t) = k δf δs s( r, t) t = k δf δs (59) TDGL (8) (8) k s t = [ T s s 3 + ξ

More information

WinHPC ppt

WinHPC ppt MPI.NET C# 2 2009 1 20 MPI.NET MPI.NET C# MPI.NET C# MPI MPI.NET 1 1 MPI.NET C# Hello World MPI.NET.NET Framework.NET C# API C# Microsoft.NET java.net (Visual Basic.NET Visual C++) C# class Helloworld

More information

2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa

2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa I 2017 11 1 SageMath SageMath( Sage ) Sage Python Sage Python Sage Maxima Maxima Sage Sage Sage Linux, Mac, Windows *1 2 Sage Sage 4 1. ( sage CUI) 2. Sage ( sage.sage ) 3. Sage ( notebook() ) 4. Sage

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

program7app.ppt

program7app.ppt プログラム理論と言語第 7 回 ポインタと配列, 高階関数, まとめ 有村博紀 吉岡真治 公開スライド PDF( 情報知識ネットワーク研 HP/ 授業 ) http://www-ikn.ist.hokudai.ac.jp/~arim/pub/proriron/ 本スライドは,2015 北海道大学吉岡真治 プログラム理論と言語, に基づいて, 現著者の承諾のもとに, 改訂者 ( 有村 ) が加筆修正しています.

More information

Microsoft Word - 3new.doc

Microsoft Word - 3new.doc プログラミング演習 II 講義資料 3 ポインタ I - ポインタの基礎 1 ポインタとは ポインタとはポインタは, アドレス ( データが格納されている場所 ) を扱うデータ型です つまり, アドレスを通してデータを間接的に処理します ポインタを使用する場合の, 処理の手順は以下のようになります 1 ポインタ変数を宣言する 2 ポインタ変数へアドレスを割り当てる 3 ポインタ変数を用いて処理 (

More information

プログラミング基礎

プログラミング基礎 C プログラミング Ⅰ 条件分岐 if~else if~else 文,switch 文 条件分岐 if~else if~else 文 if~else if~else 文 複数の条件で処理を分ける if~else if~else 文の書式 if( 条件式 1){ 文 1-1; 文 1-2; else if( 条件式 2){ 文 2-1; 文 2-2; else { 文 3-1; 文 3-2; 真条件式

More information

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( "data.t

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( data.t C++ 1 C C++ C++ C C C++ 1.1 C printf() scanf() C++ C 1-1 #include int a; scanf( "%d", &a ); printf( "a = %d\n", a ); C++ 1-2 int a; std::cin >> a; std::cout

More information

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; 19 3!!...... (+) (>) (++) (+=) for while 3.1!! 3.1.1 50 20 20 5 (20, 20) 3.1.1 (1)(Blocks1.java) public class Blocks1 extends JApplet { public void paint(graphics g){ 5 g.drawrect( 20, 20, 50, 20); g.drawrect(

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

Microsoft PowerPoint - kougi9.ppt

Microsoft PowerPoint - kougi9.ppt C プログラミング演習 第 9 回ポインタとリンクドリストデータ構造 1 今まで説明してきた変数 #include "stdafx.h" #include int _tmain(int argc, _TCHAR* argv[]) { double x; double y; char buf[256]; int i; double start_x; double step_x; FILE*

More information

プログラミング基礎

プログラミング基礎 C プログラミング Ⅱ 演習 2-1(a) BMI による判定 文字列, 身長 height(double 型 ), 体重 weight (double 型 ) をメンバとする構造体 Data を定義し, それぞれのメンバの値をキーボードから入力した後, BMI を計算するプログラムを作成しなさい BMI の計算は関数化すること ( ) [ ] [ ] [ ] BMI = 体重 kg 身長 m 身長

More information

プログラミング方法論 II 第 14,15 回 ( 担当 : 鈴木伸夫 ) 問題 17. x 座標と y 座標をメンバに持つ構造体 Point を作成せよ 但し座標 は double 型とする typedef struct{ (a) x; (b) y; } Point; 問題 18. 問題 17 の

プログラミング方法論 II 第 14,15 回 ( 担当 : 鈴木伸夫 ) 問題 17. x 座標と y 座標をメンバに持つ構造体 Point を作成せよ 但し座標 は double 型とする typedef struct{ (a) x; (b) y; } Point; 問題 18. 問題 17 の プログラミング方法論 II 第 14,15 回 ( 担当 : 鈴木伸夫 ) 問題 17. x 座標と y 座標をメンバに持つ構造体 Point を作成せよ 但し座標 は double 型とする typedef struct{ (a) x; (b) y; Point; 問題 18. 問題 17 の Point を用いて 2 点の座標を入力するとその 2 点間の距 離を表示するプログラムを作成せよ 平方根は

More information

r3.dvi

r3.dvi 00 3 2000.6.10 0 Java ( 7 1 7 1 GSSM 1? 1 1.1 4 4a 4b / / 0 255 HTML X 0 255 16 (0,32,255 #0020FF Java xclock -bg #0020FF xclock ^C (Control C xclock 4c 1 import java.applet.applet; import java.awt.*;

More information

USB 0.6 https://duet.doshisha.ac.jp/info/index.jsp 2 ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231

USB 0.6 https://duet.doshisha.ac.jp/info/index.jsp 2 ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231 0 0.1 ANSI-C 0.2 web http://www1.doshisha.ac.jp/ kibuki/programming/resume p.html 0.3 2012 1 9/28 0 [ 01] 2 10/5 1 C 2 3 10/12 10 1 2 [ 02] 4 10/19 3 5 10/26 3 [ 03] 6 11/2 3 [ 04] 7 11/9 8 11/16 4 9 11/30

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >= II 14 2018 7 26 : : proen@mm.ics.saitama-u.ac.jp 14,, 8 2 12:00 1 O(1) n O(n) O(log n) O(1) 32 : 1G int 4 250 M 2.5 int 21 2 0 100 0 100 #include #define HASHSIZE 100 /* */ #define NOTFOUND 0

More information

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

1-4 int a; std::cin >> a; std::cout << a =  << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >> 1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout

More information

Informatics 2010.key

Informatics 2010.key http://math.sci.hiroshima-u.ac.jp/ ~ryo/lectures/informatics2010/ 1 2 C ATM etc. etc. (Personal Computer) 3 4 Input Output Device Central Processing Unit I/O CPU Memory 5 6 (CPU),,... etc. C, Java, Fortran...

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

#define N1 N+1 double x[n1] =.5, 1., 2.; double hokan[n1] = 1.65, 2.72, 7.39 ; double xx[]=.2,.4,.6,.8,1.2,1.4,1.6,1.8; double lagrng(double xx); main

#define N1 N+1 double x[n1] =.5, 1., 2.; double hokan[n1] = 1.65, 2.72, 7.39 ; double xx[]=.2,.4,.6,.8,1.2,1.4,1.6,1.8; double lagrng(double xx); main =1= (.5, 1.65), (1., 2.72), (2., 7.39).2,.4,.6,.8, 1., 1.2, 1.4, 1.6 1 1: x.2 1.4128.4 1.5372.6 1.796533.8 2.198 1.2 3.384133 1.4 4.1832 1.6 5.1172 8 7 6 5 y 4 3 2 1.5 1 1.5 2 x 1: /* */ #include

More information