In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
My experience of completing the function of the basic sentences of this C language program is that I can write a functional program through many simple C language statements. I learned the most basic commands last semester, and I have carried out such a complex programming. I benefited a lot from the plane game we tried to write this time. In this program, we used the knowledge of last semester and started with INCLUDE. Then build the foundation, and then add various settings to make it a more complex program, and finally succeed in making it a simple game.
Although we have studied the course "C language programming" last semester, the knowledge I have learned is only used when I do my homework, and there is usually no chance to practice. This course design is the first time that I have designed a program through my own ideas, discussing with my classmates and constantly consulting materials. This design not only consolidated what I had learned before, but also made me have a deeper understanding of c language and mastered more skills and skills. C language is an important theoretical basis of computer programming, and it plays a very important role in our future study and work. To learn this language well, it is not enough to learn the knowledge in textbooks, but also often do it yourself and have a strong practical ability. Only by doing more and writing programs often, can we find the loopholes in our study and our own shortcomings, solve these problems in practice, and constantly improve our ability to transform knowledge.
# include "stdio.h"
# include "stdio.h"
# include "stdio.h"
# include "stdio.h"
# define N 35
Void print (int [] [N]); / / output function
Void movebul (int [] [N]); / / × × mobile function
Void movepla (int [] [N]); / / enemy aircraft movement function
Void setting (void); / / set function
Void menu (void); / / menu function
Int scr [22] [N] = {0}, pl=9,width=24,speed=3,density=30,score=0,death=0;// global variables: interface, our initial position, interface width, enemy plane speed, enemy plane density, score, death
Main (void)
{
Menu ()
Int iMago Junior 0
Scr [21] [pl] = 1
Scr [0] [5] = 3
While (1) {if (kbhit ()) switch (getch ()) / / controls moving left and right and entering the menu
{case\ a\': case\'A\': if (pl > 0) scr [21] [pl] = 0 pl SCR [21] [--break] = 1
Case\'d\': case\'D\': if (pl) scr [21] [pl] = 0 SCR [21] [+ + pl] = 1
Break
Case\'w\': case\'W\': scr [20] [pl] = 2ten breakterCase 27: setting ()
Break
}
If (+ + j%density==0) / / controls the speed of producing enemy aircraft
{jumb0transfersrand (time (NULL))
Scr [0] [rand ()% width] = 3
}
If (+ + i%speed==0) / / controls the moving speed of enemy planes, relative to the moving speed of × × ×
Movepla (scr)
Movebul (scr)
Print (scr)
If (iTunes 30000) iTunes 0ipipple / lest I cross the line
}
}
Void print (int a [] [N]) {system (\ "cls\")
Int i,j
For (iSuppli)
For (jacks 0 + +) {if (a [I] [j] = = 0) printf (\ >)
Switch (getche ())
{
Case\'1\': width=34;break
Case\'2\': width=24;break
Default:printf (\ "\ n error Please select again.\ n\ ")
Sw=1
}
}
While (sw)
Do
{
Sw=0
Printf (\ "\ nPlease select enemy aircraft density: 1. Big 2. Medium 3. Small > >\")
Switch (getche ())
{
Case\'0\': density=10
Break
Case\'1\': density=20
Break;case\'2\': density=30
Break;case\'3\': density=40;break
Default:printf (\ "\ n error Please select again.\ n\ ")
Sw=1
}
}
While (sw)
Do
{
Sw=0
Printf (\ "\ nFlight speed of enemy aircraft: 1. Fast 2. 3. Slow > >\")
Switch (getche ())
{
Case\'1\': speed=2
Break
Case\'2\': speed=3
Break
Case\'3\': speed=4
Break
Default:printf (\ "\ n error Please select again.\ n\ ")
Sw=1
}
}
While (sw)
For (iSuppli)
For (juni0bot j)
Scr [I] [j] = 0
Scr [21] [pl=9] = 1
Printf (\ "\ nPress any key to save.\")
Getch ()
}
Void menu (void)
{
Printf (\ "description: press A D to control my plane to fly left and right. W launch *\ nSettings: please press Esc\ \ nstart the game: any key\ ")
If (getch () = = 27) setting ()
}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.