How to realize the aircraft War Game with the method of Encapsulation in C language
This article Xiaobian for you to introduce in detail "C language how to use encapsulation method to achieve aircraft war game", the content is detailed, the steps are clear, and the details are handled properly. I hope that this "C language how to use encapsulation methods to achieve aircraft war games" article can help you solve your doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.
I. Project description and final results presentation
Project description: on the basis of the last time, it was encapsulated with functions, and some functions were optimized.
The final effect is as follows:
Second, encapsulation with functions
The code is as follows:
# include#include#include#include// global variable int position_x,position_y;// aircraft position int high,width;// game screen size void startup () / data initialization {high = 20; width = 30; position_x = high/2;// aircraft up and down position position_y = width/2;// aircraft left and right position} void show () / / display screen {system ("cls") Int iMagazine j; for (item0teri)