用C语言写大富翁源代码

用C语言写大富翁源代码,第1张

struct maptype

{

int money,belong

char name[20]

}map[9][13]={0}

struct player

{

int x,y,money,di

}man[3]={0}

int dx[5]={0,0,1, 0,-1}

int dy[5]={0,1,0,-1, 0}

int i,j,x,y

int turn,step,res

char out[1000]

char *s11="姓名史艳文"

char *s12="资金"

char *s21="姓名比卡超"

char *s22="资金"

char *s31="你需要付给对手"

char *s32="元"

char *s41="老友轮到你走啦"

char *s42="轮到对手走啦"

char *s51="买下此地要粗胡"

char *s52="买"

char *s53="不买"

char *s54="老大你的钱不够"

char *z1="起点"

char *z2="休息处"

char *fa="经过起点发旅费"

char *m1="路过岳王庙"

char *m2="路过纯白镇"

char *m3="获取钱三千"

char *m4="获取钱六千"

char *zi1="行"掘判

char *zi2="动"

char *zi3="查"

char *zi4="看"

char *zi5="离"

char *zi6="开"

char *last="你要花两千元升级地价吗"

#define ESC 0x011b

#define ENTER 0x1c0d

#define LEFT 0x4b00

#define RIGHT 0x4d00

#define UP0x4800

#define DOWN 0x5000

#include<stdio.h>

#include<stdlib.h>

#include"first.c"

#include<graphics.h>

#include "bmp16.h"

#include"files.c"

int graphdriver=VGA

int graphmode=VGAHI

FILE *hzk_p

void open_hzk(void)

void get_hz(char incode[],char bytes[])

void dishz(int x,int y,char code[],int color)

#include"rich2.c"

int main()

{

initgraph(&graphdriver,&graphmode,"")

cleardevice()

open_hzk()

first()

begin()

files()

setbkcolor(0)

while (1)

{

print(0)

step=random(6)+1

{}

if (turn==1)

{

next3()

}

chuli(turn,step)

buy()

{}

turn=(turn+1)%2

if (turn==0)

turn=2

step=0

}

return 0

}

void open_hzk()

{

hzk_p=fopen("hzk16","rb"判凳改)

if (!hzk_p)

{

printf("The file no\n")

getch()

closegraph()

exit(1)

}

}

void get_hz(char incode[],char bytes[])

{

unsigned char qh,wh

unsigned long offset

qh=incode[0]-0xa0

wh=incode[1]-0xa0

offset=(94*(qh-1)+(wh-1))*32L

fseek(hzk_p,offset,SEEK_SET)

fread(bytes,32,1,hzk_p)

}

void dishz(int x0,int y0,char code[],int color)

{

unsigned char mask[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}

int i,j,x,y,pos

char mat[32]

get_hz(code,mat)

y=y0

for(i=0i<16i++)

{

x=x0

pos=2*i

for (j=0j<16j++)

{

if ((mask[j%8]&mat[pos+j/8])!=NULL)

putpixel(x,y,color)

++x

}

++y

}

}

应该这派谨样子,只需要计算富翁的收入就行了 不需要管陌生人的,无视一个月是38天吧。。。尘弊基 另外 一分确实是0.01元。。。不是0.001

#include<stdio.h>

int main()

{

int i

double sumfu=0,y=0.01,m

scanf("%lf",&m)

for(i=1i<=38i++)

{

sumfu=sumfu+m-y

y=y*2

if(sumfu<0 ){printf("%d",i)getch()exit(0)}/*只要富翁卜郑的收入小于0 ,就说明他开始亏了*/

}

}

#include<亩孙stdio.h>禅耐橡

void main()

{ int count=1

int rich_sum=0

int money_rich=1

int money_poor=100000

for(int i=1i<30i++)

{

rich_sum=rich_sum+money_rich

money_rich=2*money_rich

rich_sum=rich_sum+money_rich

}

money_poor=money_poor*30

printf("富贺旁人要给陌生人%d\n",rich_sum)

printf("陌生人要给富人%d\n",money_poor)

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/12484994.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存