大家好,今天小编来为大家解答c语言银行pos机程序这个问题,c语言银行pos机程序是什么很多人还不知道,现在让我们一起来看看吧!
本文目录
建行pos机错误码9001?c语言中pos是什么意思?c语言贪吃蛇代码及解析?贪吃蛇c语言代码最短?c语言pos什么意思?建行pos机错误码9001?pos机错误码9001是信用卡没有激活。持卡人可以通过卡背面的客服热线按语音提示进行激活。
银行卡芯片磁条损坏磨损。如果没有消磁在多试几次后可以成功。或者前往柜台或ATM机试刷,如确认磁条损坏,致电客服申请卡片重制。
POS机线路繁忙或出现故障。可以稍后重试。
卡片或账户状态不正常,如已过有效期、挂失、冻结等。
c语言中pos是什么意思?pos和j都是c语言中的变量名字。当然poss也是另一个变量的名字。执行pos++和j=poss这两句的作用分别是:pos++——这是后自加语句(能够执行这一句,前提是pos变量必须是数值型变量)。功能是执行完这一句之后,pos存放的值加上了1
c语言贪吃蛇代码及解析?#include
#include
#include
#include
#defineU1
#defineD2
#defineL3
#defineR4//蛇的状态,U:上;D:下;L:左R:右
typedefstructSNAKE//蛇身的一个节点
{
intx;
inty;
structSNAKE*next;
}snake;
//全局变量//
intscore=0,add=10;//总得分与每次吃食物得分。
intstatus,sleeptime=200;//每次运行的时间间隔
snake*head,*food;//蛇头指针,食物指针
snake*q;//遍历蛇的时候用到的指针
intendgamestatus=0;//游戏结束的情况,1:撞到墙;2:咬到自己;3:主动退出游戏。
//声明全部函数//
voidPos();
voidcreatMap();
voidinitsnake();
intbiteself();
voidcreatefood();
voidcantcrosswall();
voidsnakemove();
voidpause();
voidgamecircle();
voidwelcometogame();
voidendgame();
voidgamestart();
voidPos(intx,inty)//设置光标位置
{
COORDpos;
HANDLEhOutput;
pos.X=x;
pos.Y=y;
hOutput=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOutput,pos);
}
voidcreatMap()//创建地图
{
inti;
for(i=0;i<58;i+=2)//打印上下边框
{
Pos(i,0);
printf("■");
Pos(i,26);
printf("■");
}
for(i=1;i<26;i++)//打印左右边框
{
Pos(0,i);
printf("■");
Pos(56,i);
printf("■");
}
}
voidinitsnake()//初始化蛇身
{
snake*tail;
inti;
tail=(snake*)malloc(sizeof(snake));//从蛇尾开始,头插法,以x,y设定开始的位置//
tail->x=24;
tail->y=5;
tail->next=NULL;
for(i=1;i<=4;i++)
{
head=(snake*)malloc(sizeof(snake));
head->next=tail;
head->x=24+2*i;
head->y=5;
tail=head;
}
while(tail!=NULL)//从头到为,输出蛇身
{
Pos(tail->x,tail->y);
printf("■");
tail=tail->next;
}
}
intbiteself()//判断是否咬到了自己
{
snake*self;
self=head->next;
while(self!=NULL)
{
if(self->x==head->x&&self->y==head->y)
{
return1;
}
self=self->next;
}
return0;
}
voidcreatefood()//随机出现食物
{
snake*food_1;
srand((unsigned)time(NULL));
food_1=(snake*)malloc(sizeof(snake));
while((food_1->x%2)!=0)//保证其为偶数,使得食物能与蛇头对其
{
food_1->x=rand()%52+2;
}
food_1->y=rand()%24+1;
q=head;
while(q->next==NULL)
{
if(q->x==food_1->x&&q->y==food_1->y)//判断蛇身是否与食物重合
{
free(food_1);
createfood();
}
q=q->next;
}
Pos(food_1->x,food_1->y);
food=food_1;
printf("■");
}
voidcantcrosswall()//不能穿墙
{
if(head->x==0||head->x==56||head->y==0||head->y==26)
{
endgamestatus=1;
endgame();
}
}
voidsnakemove()//蛇前进,上U,下D,左L,右R
{
snake*nexthead;
cantcrosswall();
nexthead=(snake*)malloc(sizeof(snake));
if(status==U)
{
nexthead->x=head->x;
nexthead->y=head->y-1;
if(nexthead->x==food->x&&nexthead->y==food->y)//如果下一个有食物//
{
nexthead->next=head;
head=nexthead;
q=head;
while(q!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
score=score+add;
createfood();
}
else//如果没有食物//
{
nexthead->next=head;
head=nexthead;
q=head;
while(q->next->next!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
Pos(q->next->x,q->next->y);
printf("");
free(q->next);
q->next=NULL;
}
}
if(status==D)
{
nexthead->x=head->x;
nexthead->y=head->y+1;
if(nexthead->x==food->x&&nexthead->y==food->y)//有食物
{
nexthead->next=head;
head=nexthead;
q=head;
while(q!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
score=score+add;
createfood();
}
else//没有食物
{
nexthead->next=head;
head=nexthead;
q=head;
while(q->next->next!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
Pos(q->next->x,q->next->y);
printf("");
free(q->next);
q->next=NULL;
}
}
if(status==L)
{
nexthead->x=head->x-2;
nexthead->y=head->y;
if(nexthead->x==food->x&&nexthead->y==food->y)//有食物
{
nexthead->next=head;
head=nexthead;
q=head;
while(q!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
score=score+add;
createfood();
}
else//没有食物
{
nexthead->next=head;
head=nexthead;
q=head;
while(q->next->next!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
Pos(q->next->x,q->next->y);
printf("");
free(q->next);
q->next=NULL;
}
}
if(status==R)
{
nexthead->x=head->x+2;
nexthead->y=head->y;
if(nexthead->x==food->x&&nexthead->y==food->y)//有食物
{
nexthead->next=head;
head=nexthead;
q=head;
while(q!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
score=score+add;
createfood();
}
else//没有食物
{
nexthead->next=head;
head=nexthead;
q=head;
while(q->next->next!=NULL)
{
Pos(q->x,q->y);
printf("■");
q=q->next;
}
Pos(q->next->x,q->next->y);
printf("");
free(q->next);
q->next=NULL;
}
}
if(biteself()==1)//判断是否会咬到自己
{
endgamestatus=2;
endgame();
}
}
voidpause()//暂停
{
while(1)
{
Sleep(300);
if(GetAsyncKeyState(VK_SPACE))
{
break;
}
}
}
voidgamecircle()//控制游戏
{
Pos(64,15);
printf("不能穿墙,不能咬到自己\n");
Pos(64,16);
printf("用↑.↓.←.→分别控制蛇的移动.");
Pos(64,17);
printf("F1为加速,F2为减速\n");
Pos(64,18);
printf("ESC:退出游戏.space:暂停游戏.");
Pos(64,20);
printf("c语言研究中心www.dotcpp.com");
status=R;
while(1)
{
Pos(64,10);
printf("得分:%d",score);
Pos(64,11);
printf("每个食物得分:%d分",add);
if(GetAsyncKeyState(VK_UP)&&status!=D)
{
status=U;
}
elseif(GetAsyncKeyState(VK_DOWN)&&status!=U)
{
status=D;
}
elseif(GetAsyncKeyState(VK_LEFT)&&status!=R)
{
status=L;
}
elseif(GetAsyncKeyState(VK_RIGHT)&&status!=L)
{
status=R;
}
elseif(GetAsyncKeyState(VK_SPACE))
{
pause();
}
elseif(GetAsyncKeyState(VK_ESCAPE))
{
endgamestatus=3;
break;
}
elseif(GetAsyncKeyState(VK_F1))
{
if(sleeptime>=50)
{
sleeptime=sleeptime-30;
add=add+2;
if(sleeptime==320)
{
add=2;//防止减到1之后再加回来有错
}
}
}
elseif(GetAsyncKeyState(VK_F2))
{
if(sleeptime<350)
{
sleeptime=sleeptime+30;
add=add-2;
if(sleeptime==350)
{
add=1;//保证最低分为1
}
}
}
Sleep(sleeptime);
snakemove();
}
}
voidwelcometogame()//开始界面
{
Pos(40,12);
system("titlec语言研究中心www.dotcpp.com");
printf("欢迎来到贪食蛇游戏!");
Pos(40,25);
system("pause");
system("cls");
Pos(25,12);
printf("用↑.↓.←.→分别控制蛇的移动,F1为加速,2为减速\n");
Pos(25,13);
printf("加速将能得到更高的分数。\n");
system("pause");
system("cls");
}
voidendgame()//结束游戏
{
system("cls");
Pos(24,12);
if(endgamestatus==1)
{
printf("对不起,您撞到墙了。游戏结束.");
}
elseif(endgamestatus==2)
{
printf("对不起,您咬到自己了。游戏结束.");
}
elseif(endgamestatus==3)
{
printf("您的已经结束了游戏。");
}
Pos(24,13);
printf("您的得分是%d\n",score);
exit(0);
}
voidgamestart()//游戏初始化
{
system("modeconcols=100lines=30");
welcometogame();
creatMap();
initsnake();
createfood();
}
intmain()
{
gamestart();
gamecircle();
endgame();
return0;
}
贪吃蛇c语言代码最短?#include
#include
#include
usingnamespacestd;
voidgotoxy(intx,inty){COORDpos={x,y};SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}//光标定位
classFood{//食物类
private:intm_x;intm_y;
public:
voidrandfood(){//随机产生一个食物
srand((int)time(NULL));//利用时间添加随机数种子,需要ctime头文件
L1:{m_x=rand()%(85)+2;//2~86
m_y=rand()%(25)+2;//2~26
if(m_x%2)gotoL1;//如果食物的x坐标不是偶数则重新确定食物的坐标
gotoxy(m_x,m_y);//在确认好的位置输出食物
cout<<"★";}}
intgetFoodm_x(){returnm_x;}//返回食物的x坐标
intgetFoodm_y(){returnm_y;}};//返回食物的y坐标
classSnake{
private:
structSnakecoor{intx;inty;};//定义一个蛇的坐标机构
vector
//判断并改变前进方向的函数
voiddegdir(Snakecoor&nexthead){//定义新的蛇头变量
staticcharkey='d';//静态变量防止改变移动方向后重新改回来
if(_kbhit()){
chartemp=_getch();//定义一个临时变量储存键盘输入的值
switch(temp){//如果临时变量的值为wasd中的一个,则赋值给key
default:break;//default是缺省情况,只有任何条件都不匹配的情况下才会执行必须写在前面!不然蛇无法转向
case'w':case'a':case's':case'd':
//如果temp的方向和key的方向不相反则赋值因为两次移动方向不能相反将蛇设置为初始向右走
if(key=='w'&&temp!='s'||key=='s'&&temp!='w'||key=='a'&&temp!='d'||key=='d'&&temp!='a')key=temp;}}
switch(key){//根据key的值来确定蛇的移动方向
case'd':nexthead.x=snakecoor.front().x+2;nexthead.y=snakecoor.front().y;break;
//新的蛇头的头部等于容器内第一个数据(旧蛇头)x坐标+2因为蛇头占两个坐标,移动一次加2
case'a':nexthead.x=snakecoor.front().x-2;nexthead.y=snakecoor.front().y;break;
case'w':nexthead.x=snakecoor.front().x;nexthead.y=snakecoor.front().y-1;break;
//因为控制台的x长度是y的一半,所以用两个x做蛇头,需要的坐标是二倍
case's':nexthead.x=snakecoor.front().x;nexthead.y=snakecoor.front().y+1;}}
//游戏结束时设计一个界面输出“游戏结束”以及分数
voidfinmatt(constintscore){
system("cls");gotoxy(40,14);//清屏然后输出
cout<<"游戏结束";gotoxy(40,16);
cout<<"得分:"< exit(0);}//exit为C++的退出函数exit(0)表示程序正常退出,非0表示非正常退出 voidfinishgame(constintscore){//游戏结束 if(snakecoor[0].x>=88||snakecoor[0].x<0||snakecoor[0].y>=28||snakecoor[0].y<0)finmatt(score);//撞墙 for(inti=1;i c语言编程中intpos;是什么意思? 声明一个整型变量,变量名为pos。 以后可以给它赋值,也可以参与运算,或输入输出,如: pos=100; pos=ab; pe=100*pos; scanf(%d, printf(%d,pos); 等等。 c语言中函数Pos(40,12);是什么意思?步骤 这个Pos是程序中自己实现的一个函数,参数为两个整形参数。 所以调用Pos函数是需要传入40和12两个整形参数。 sum=(c==)?0:pos*(c-A1);在c语言中代表什么意思 ?:是条件运算符。 这句话的意思是: 如果c==‘’成立,则sum=0也就是sum=sum0; 如果c==‘’不成立,则sum=pos*(c-A1);也就是sum=sumpos*(c-A1); OK,关于c语言银行pos机程序和c语言银行pos机程序是什么的内容到此结束了,希望对大家有所帮助。 本文来自用户投稿,不代表POS机办理网立场,如若转载,请注明出处:https://tlx668.com/poszx/21611.html
发表回复
评论列表(0条)