24点扑克牌游戏
2008-03-08 12:30:26 来源:WEB开发网核心提示:#include<stdio.h>#include<graphics.h>#include<ctype.h>#include<time.h>#include<stdlib.h>#include<string.h>#define COL 100#de
#include<stdio.h>
#include<graphics.h>
#include<ctype.h>
#include<time.h>
#include<stdlib.h>
#include<string.h>
#define COL 100
#define COM 40
#define max 20
char after[max];
typedef strUCt stack /*定义栈1存放运算符*/
{
char stack[max];
int top;
}stack;
stack L;
typedef struct stack1 /*定义栈2计算表达式值*/
{
int stack1[max];
int top;
}stack1;
stack1 S;
void initstack(stack M)
{
M->top=0;
}
voidinitstack1(stack1 N)
{
N->top=0;
}
char p[4][13]={
{'A','2,'3','4','5','6','7','8','9','0','J','Q','K'},
{'A','2,'3','4','5','6','7','8','9','0','J','Q','K'},
{'A','2,'3','4','5','6','7','8','9','0','J','Q','K'},
{'A','2,'3','4','5','6','7','8','9','0','J','Q','K'}
};
void play() /*发牌函数*/
{
int j;
for(j=1;j<=4;j++)
{
bar(COL+100*j-35,COM+100-50,COL+100*j+35,COM+100+50);
setcolor(BLUE);
rectangle(COL+100*j-32,COM+100-48,COL+100*j+32,COM+100+48);
rand1(j);
delay(10000);
}
}
void rand1(int j)
{
int kind,number;
char str[3];
randomize();
while(1)
{
kind=random(4);
num=random(13);
if(p[kind][num]!=-1)
{
n=p[kind][num];
p[kind][num]=-1;
break;
}
}
switch(kind)
{
case 0:
setcolor(RED);
sPRintf(str,"%c",3);
break;
case 1:
setcolor(BLACK);
sprintf(str,"%c",3);
break;
case 2:
setcolor(RED);
sprintf(str,"%c",4);
break;
case 3:
setcolor(BLACK);
sprintf(str,"%c",5);
break;
}
settextstyle(0,0,2);
outtextxy(COL+j*100-30,ROW+100-46,str);
outtextxy(COL+j*100+16,ROW+100+32,str);
if(n!='0')
{
settextstyle(0,0,3);
sprintf(str,"%c",n);
outtextxy(COL+j*100-5,ROW+100-5,str);
}
else
{
sprintf("str,"%d",10);
outtextxy(COL+j*100-6,ROW+100-5,str);
}
}
int text1(char *s) /*显示文本*/
{
setbkcolor(BLUE);
cleardevice();
setcolor(12);
settextstyle(1,0,8);
outtextxy(120,120,s);
setusercharsize(2,1,4,1);
setcolor(15);
settextxy(220,220,s);
getch();
return;
}
void init()
{int gdriver,gmode;
gdriver=DETECT;
initgraph(&gdriver,&gmode,"d:\\turboc2");
cleardevice();
}
void close()
{
closegraph();
}
void change(char stm[]) /*将表达式的输出类型进行转换*/
{int i=0,j=0;
char ch;
initstack(L);
ch=stm[i];
while(ch!='\0')
{
while(isdigit(ch)ch='.')
{
after[j]=ch;
j++;
ch=stm[++i];
}
switch(ch)
{
case '+':
case '-':
while(L->top!=0&&L->stack[L->top]!='(')
{
after[j]=L->stack[L->top];
j++;
L->top--;
}
L->top++;
 
[]
- ››游戏网《千军破》名将养成秘籍
- ››游戏定位成牵引Android发展的火车头
- ››游戏的知识时代?传媒大佬闯入游戏江湖
- ››游戏场景烘焙贴图制作
- ››游戏植物大战僵尸 iPhone 版9天销售额超100万美元...
- ››游戏开发包 iPhone cocos2d 初体验
- ››游戏三维怪物施法特效教程
- ››游戏人生Silverlight(2) - 趣味钢琴[Silverlight ...
- ››游戏人生Silverlight(3) - 打苍蝇[Silverlight 2....
- ››游戏人生Silverlight(4) - 连连看[Silverlight 2....
- ››游戏人生Silverlight(5) - 星际竞技场[Silverligh...
- ››游戏圈第一款巧克力周边即将浮出水面
赞助商链接