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