#include <time.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int dice1(int iroll1); int dice2(int iroll2); main(){ srand(time(NULL)); int iDiceValue1, iDiceValue2,isumdice; int iVal1=0, iVal2=0, again=0; int ilocate=0; int x=0; int count[x]; while(x!=40){ count[x]=0; x++; } do { iDiceValue1 = dice1(iVal1); iDiceValue2 = dice2(iVal2); isumdice = iDiceValue1 + iDiceValue2; printf("\n%d \t ",isumdice); ilocate = ilocate + isumdice; if(ilocate>39){ ilocate = ilocate % 10; } if(ilocate==0){ printf("GO"); count[0]++; } else if(ilocate==1){ printf("HILLSIDE AVENUE"); count[1]++; } else if(ilocate==2){ printf("COMMUNITY CHEST"); count[2]++; } else if(ilocate==3){ printf("HILLSIDE CRESCENT"); count[3]++; } else if(ilocate==4){ printf("INCOME TAX"); count[4]++; } else if(ilocate==5) { printf("TOWN HALL"); count[5]++; } else if(ilocate==6) { printf("WELTON VALE"); count[6]++; } else if(ilocate==7) { printf("CHANCE?"); count[7]++; } else if(ilocate==8) { printf("BELLE VIEW"); count[8]++; } else if(ilocate==9) { printf("VALLEY WALK"); count[9]++; } else if(ilocate==10) { printf("JAIL"); count[10]++; } else if(ilocate==11) { printf("ROCKY ROAD"); count[11]++; } else if(ilocate==12) { printf("TESCO"); count[12]++; } else if(ilocate==13) { printf("GULLOCK TYNING"); count[13]++; } else if(ilocate==14) { printf("RACKVERNAL ROAD"); count[14]++; } else if(ilocate==15) { printf("WESTFIELD CHAPEL"); count[15]++; } else if(ilocate==16) { printf("WATERFORD PARK"); count[16]++; } else if(ilocate==17) { printf("COMMUNITY CHEST"); count[17]++; } else if(ilocate==18) { printf("ALDER TERRACE"); count[18]++; } else if(ilocate==19) { printf("WESTFIELD TERRACE"); count[19]++; } else if(ilocate==20){ printf("FREE PARKING"); count[20]++; } else if(ilocate==21){ printf("SOUTH ROAD"); count[21]++; } else if(ilocate==22){ printf("CHANCE"); count[22]++; } else if(ilocate==23){ printf("SILVER STREET"); count[23]++; } else if(ilocate==24){ printf("ST CHADS AVENUE"); count[24]++; } else if(ilocate==25){ printf("SOMERVALE SCHOOL"); count[25]++; } else if(ilocate==26){ printf("LONG BARNABY"); count[26]++; } else if(ilocate==27){ printf("BLACKBERRY WAY"); count[27]++; } else if(ilocate==28){ printf("SANSIBURYS"); count[28]++; } else if(ilocate==29){ printf("CLAPTON ROAD"); count[29]++; } else if(ilocate==30){ printf("GO TO JAIL"); count[30]++; ilocate = 10; } else if(ilocate==31){ printf("BLUEBELL RISE"); count[31]++; } else if(ilocate==32){ printf("MONGER LANE"); count[32]++; } else if(ilocate==33){ printf("COMMUNITY CHEST"); count[33]++; } else if(ilocate==34){ printf("GREENFIELD WALK"); count[34]++; } else if(ilocate==35){ printf("NORTON HILL SCHOOL"); count[35]++; } else if(ilocate==36){ printf("NORTH ROAD"); count[36]++; } else if(ilocate==37){ printf("CHANCE"); count[37]++; } else if(ilocate==38){ printf("LUXURY TAX"); count[38]++; } else{ printf("THE DYMBORO"); count[39]++; } again++; getch(); } while(again!=100); } int dice1(int iroll1){ int irollvalue1 = rand(); irollvalue1= (irollvalue1 % 6) + 1; return irollvalue1; } int dice2(int iroll2){ int irollvalue2 = rand(); irollvalue2= (irollvalue2 % 6) + 1; return irollvalue2; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)