網上有很多關于pos機免費領源碼,小伙僅用200行C++代碼的知識,也有很多人為大家解答關于pos機免費領源碼的問題,今天pos機之家(www.www690aa.com)為大家整理了關于這方面的知識,讓我們一起來看下吧!
本文目錄一覽:
pos機免費領源碼
小編是一個有著6年工作經驗的工程師,關于C++編程,自己有做材料的整合,一個完整的C++編程學習路線,學習資料和工具,能夠進我的群10048,-83029收取,免費送給大家,希望你也能憑著自己的努力,成為下一個優秀的程序員
#include<stdio.h> #include<process.h> #include<windows.h> #include<conio.h> #include<time.h> #include<stdlib.h> #define width="360px",height="auto" />
tail;//蛇身 int SPEECH=200; int score=0;//分數 int smark=0;//吃食物標記 int times=0; int STOP=0; void Initfood();//產生食物 void Initsnake();//構造snake void Eatfood();//頭部前進 void Addnode(int x, int y);//增加蛇身 void display(struct Node *shead);//顯示蛇身坐標 void move();//蛇移動 void draw();//畫蛇 void Homepage();//主頁 void keybordhit();//監控鍵盤按鍵 void Addtail();//吃到食物 void gotoxy(int x, int y)//定位光標 { COORD pos; pos.X = x - 1; pos.Y = y - 1; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos); } void Initsnake()//構造snake { int i; snake=(struct Snake*)malloc(sizeof(struct Snake)); tail=(struct Node*)malloc(sizeof(struct Node)); food = (struct Food*)malloc(sizeof(struct Food)); snake->lenth=5;//初始長度 5 snake->dir=RIGHT;//初始蛇頭方向 右 for(i=2;i<=snake->lenth+2;i++)//增加 5 個結點 { Addnode(i,2); } } void Initfood()//產生食物 { struct Node *p=snode; int mark=1;srand((unsigned)time(NULL));//以時間為種子產生隨機數 while(1) { food->x=rand()%(width="360px",height="auto" />
break; } p=p->next; } if(mark==1)//如果食物不在蛇身上,生成食物,否則重新生成食物 { gotoxy(food->x,food->y); printf("%c",3); break; } mark=1; p=snode; } } void move()//移動 { struct Node *q, *p=snode; if(snake->dir==RIGHT) { Addnode(p->x+1,p->y); if(smark==0) { while(p->next!=NULL) { q=p; p=p->next; } q->next=NULL; free(p); } } if(snake->dir==LEFT) { Addnode(p->x-1,p->y); if(smark==0) { while(p->next!=NULL) { q=p; p=p->next; } q->next=NULL; free(p); } } if(snake->dir==UP) { Addnode(p->x,p->y-1); if(smark==0) { while(p->next!=NULL) { q=p; p=p->next; } q->next=NULL; free(p); } } if(snake->dir==DOWN) { Addnode(p->x,p->y+1); if(smark==0) { while(p->next!=NULL) { q=p; p=p->next; } q->next=NULL; free(p); } } } void Addnode(int x, int y)//增加蛇身 { struct Node *newnode=(struct Node *)malloc(sizeof(struct Node)); struct Node *p=snode; newnode->next=snode; newnode->x=x; newnode->y=y; snode=newnode;//結點加到蛇頭 if(x<2||x>=width="360px",height="auto" />初學編程的同學可以參考 聯系我學習
以上就是關于pos機免費領源碼,小伙僅用200行C++代碼的知識,后面我們會繼續為大家整理關于pos機免費領源碼的知識,希望能夠幫助到大家!

轉發請帶上網址:http://www.www690aa.com/newsone/71769.html