網(wǎng)上有很多關(guān)于pos機(jī)免費(fèi)領(lǐng)源碼,小伙僅用200行C++代碼的知識(shí),也有很多人為大家解答關(guān)于pos機(jī)免費(fèi)領(lǐng)源碼的問(wèn)題,今天pos機(jī)之家(www.dsth100338.com)為大家整理了關(guān)于這方面的知識(shí),讓我們一起來(lái)看下吧!
本文目錄一覽:
pos機(jī)免費(fèi)領(lǐng)源碼
小編是一個(gè)有著6年工作經(jīng)驗(yàn)的工程師,關(guān)于C++編程,自己有做材料的整合,一個(gè)完整的C++編程學(xué)習(xí)路線,學(xué)習(xí)資料和工具,能夠進(jìn)我的群10048,-83029收取,免費(fèi)送給大家,希望你也能憑著自己的努力,成為下一個(gè)優(yōu)秀的程序員
#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;//分?jǐn)?shù) int smark=0;//吃食物標(biāo)記 int times=0; int STOP=0; void Initfood();//產(chǎn)生食物 void Initsnake();//構(gòu)造snake void Eatfood();//頭部前進(jìn) void Addnode(int x, int y);//增加蛇身 void display(struct Node *shead);//顯示蛇身坐標(biāo) void move();//蛇移動(dòng) void draw();//畫(huà)蛇 void Homepage();//主頁(yè) void keybordhit();//監(jiān)控鍵盤(pán)按鍵 void Addtail();//吃到食物 void gotoxy(int x, int y)//定位光標(biāo) { COORD pos; pos.X = x - 1; pos.Y = y - 1; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos); } void Initsnake()//構(gòu)造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;//初始長(zhǎng)度 5 snake->dir=RIGHT;//初始蛇頭方向 右 for(i=2;i<=snake->lenth+2;i++)//增加 5 個(gè)結(jié)點(diǎn) { Addnode(i,2); } } void Initfood()//產(chǎn)生食物 { struct Node *p=snode; int mark=1;srand((unsigned)time(NULL));//以時(shí)間為種子產(chǎn)生隨機(jī)數(shù) 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()//移動(dòng) { 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;//結(jié)點(diǎn)加到蛇頭 if(x<2||x>=width="360px",height="auto" />初學(xué)編程的同學(xué)可以參考 聯(lián)系我學(xué)習(xí)
以上就是關(guān)于pos機(jī)免費(fèi)領(lǐng)源碼,小伙僅用200行C++代碼的知識(shí),后面我們會(huì)繼續(xù)為大家整理關(guān)于pos機(jī)免費(fèi)領(lǐng)源碼的知識(shí),希望能夠幫助到大家!
