Compiling...
121. The CPP
C: \ users \ asus \ desktop \ 121. CPP (267) : warning C4508: 'main' : the function should return a value. 'void' return type assumed
C: \ users \ asus \ desktop \ 121. CPP (60) : warning C4102: 'loop' : unreferenced label
C: \ users \ asus \ desktop \ 121. CPP (56) : warning C4101: 'm: unreferenced local variable
After the BUILD
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the Configuration: 121 - Win32 Debug -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Linking...
121. Obj: error LNK2001: unresolved external symbol __imp__mciSendStringA @ 16
The Debug/121. Exe: fatal error LNK1120:1 unresolved externals
An error occurred when execution link. Exe.
121. Exe - 1 error (s), and 0 warning (s)
All code is as follows:
# include
#include
#include
#include
#include
#include
# define BLOOD_1 3
# define BLOOD_2 2
# define xMAX 30
# define xMIN 10
# define yMAX 23
# define yMIN 2
# define MAXLEN 40
Struct Plane {
int x;
int y;
Int "blood;
} plane, enemy [MAXLEN], bullet [320].
Int missile=0;//slow speed
Int reprint=0;//whether or not to print
Int score=0;//score
Void gotoxy (int x, int y)//the cursor to the (x, y), in which the coordinates of the upper left corner (1, 1), x as the column, line y is
{
COORD COORD=1} {x 1, y -;
SetConsoleCursorPosition
(GetStdHandle (STD_OUTPUT_HANDLE), coord);
}
Int main ()
{
IMAGE img.
//interface background
IMAGE img1;
//mouse messages defined
MOUSEMSG m;
McISendString (" open music. Mp3 alias up mymusic ", NULL, 0, NULL);
McISendString (" play up mymusic repeat ", NULL, 0, NULL);
Initgraph (800600);
Loop:
Loadimage (& amp; Img, "PIC. JPG");//read the image to the img object
Putimage (0, 0, & amp; Img);//display IMAGE object in coordinates
Setfillcolor (RGB (201, 136, 92));//help color
Setbkmode (TRANSPARENT);//transparent background Settings
Settextcolor (WHITE);//help font color
Setlinecolor (RGB (274, 244, 185));//color box border
Fillroundrect (500, 290, 700, 360, 56, 67);//box
Settextcolor (RGB (255201, 14));//the words in the box
Settextstyle (40, 50, "tahoma");//font
Setbkmode (TRANSPARENT);//transparent background Settings
Outtextxy (522, 300, "Play");//Play
Settextstyle (110, 70, "Chinese amber");//end set
Outtextxy (60, 70, "flying");//character shows
Void the Print ();//output basic information
Void del (struct Plane arr [], int n);
Void print (struct Plane Plane, struct Plane enemy [], int count_1, struct Plane bullet [], int count_2);//print interface
Int enemy_create (struct Plane enemy [], int count);//create the enemy planes
Int bullet_create (struct Plane bullet [], int count, int x, int y);//create the bullet
Int count_1=0, count_2=0;//number of enemy planes and the bullet number count
Int situation=1, I, j;
Char ch;//button
Plane. "=BLOOD_1;
Plane. X=(xMAX + xMIN)/2;
Plane. Y=(yMAX + yMIN)/2;//the plane position initialization
Print ();
While (situation)
//determine game ever end
{
Gotoxy (1, 1);
Slow++;
If (slow> 1000000)
Missile=0;//deceleration setting
Sleep (20);
If (kbhit ())
{
Ch=getch ();
for(i=0; Kbhit () & amp; & i<30; I++)//the cycle for new empty record buffer of the keyboard (don't know whether it is true that emptied, anyway effect achieved)
Ch=getch ();
The switch (ch)
{
Case 'w' : plane. - y; break;
Case 'a' : plane. X -; break;
Case 's' : plane. Y++; break;
Case 'd' : plane. X++; break;
Case: 'z' system (" pause ");
}
If (plane. X
Plane. X=xMIN;
If (plane. X> XMAX)
Plane. X=xMAX;
If (plane. Y> YMAX)
Plane. Y=yMAX;
If (plane. Y
Plane. Y=yMIN;
}
If (missile % 5==0)//bullets slowdown
{
for(i=0; i
{
Bullet [I]. - y;//the bullet rise
If (bullet [I] y
{
Del (bullet, I);
Count_2 -;
I -;
}
for(j=0; J
If (enemy [j]. Journal of x==bullet [I] x& & Enemy [j]. J y==bullet [I] y)
{
Del (bullet, I);
Count_2 -;
Enemy [j]. Journal of blood -;
If (enemy [j]. "==0)//judgment HP
{
Del (enemy, j);
Count_1 -;
Score++;
}
}
}
Count_2=bullet_create (bullet, count_2, plane x, plane, y);
}
If (missile % 25==0)//enemy aircraft deceleration
{
for(i=0; i
{
Enemy [I] y++;
If (enemy [I] y> YMAX | | (enemy [I]. X==plane. X& & Enemy [I] y==plane. Y))
{
Del (enemy, I);
Count_1 -;
I -;
}
}
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull