OK heres the deal see, I'm playing around with C++'s rand functions n' such, When I decide I want to make a dice rolling sim. here is what I have:
I keep getting a Linker Error, like the one below :::Code:/****************************************** * Die Roll Simulator ** * Coded by Seth Collins ** * Made to provide random numbers as ** * Quickly and efficeintly as dice ** ******************************************/ /* Includes: iostream, ctime, windows.h, cstdlib, time.h */ #include <iostream> #include <ctime> #include <windows.h> #include <cstdlib> #include <time.h> /* Namespace: STD standard */ using namespace std; /* Variables: * iSides = integer, reprisents number of sides on die * iNumbr = integer, represents number of dice * iTotal = integer, total after rolled dice are added togather */ int iSides; int iNumbr; int iTotal; /*RandInt Function *creates RandInt funct for easy reading */ int RandInt(int a, int b){ return a + rand() % (b - a + 1); } /* d4 Function * This defines the four sided die */ int d4(int iNumbr){ for ( true;iNumbr;iNumbr--){ srand(unsigned(time(NULL))); iTotal += RandInt(1,4); } } /* d6 Function * This defines the six sided die */ int d6(int iNumbr){ for(true;iNumbr;iNumbr--){ srand(unsigned(time(NULL))); iTotal += RandInt(1,6); } } /* d8 Function * This defines the eight sided die */ int d8(int iNumbr){ for(true;iNumbr;iNumbr--){ srand(unsigned(time(NULL))); iTotal += RandInt(1,8); } } /* d10 Function * This defines the ten sided die */ int d10(int iNumbr){ for(true;iNumbr;iNumbr--){ srand(unsigned(time(NULL))); iTotal += RandInt(1,10); } } /* d12 Function * This defines the twelve sided die */ int d12(int iNumbr){ for(true;iNumbr;iNumbr--){ srand(unsigned(time(NULL))); iTotal += RandInt(1,12); } } /* d20 Function * This defines the twenty sided die */ int d20(int iNumbr){ for(true;iNumbr;iNumbr--){ srand(unsigned(time(NULL))); iTotal += RandInt(1,20); } } /* Main Function * In the sceme of things this Fuction is merely a moderator * no matter how puney, it ties the other functions togather */ int Main(int iSides, int iTotal, int iNumbr){ cout << " \n Dice Roller v1.!\n::::::::::::::::::::" //Title and version << "\n:::::How many dice are you going to Roll? "; //prompt # o' dice cin >> iNumbr; // input variable iNumbr do{ // do{}while() loop cout <<"\n:::::Alright! How many sides are on the dice?"//prompt sides << " 4, 6, 8, 10, 12, or 20? "; //options cin >> iSides; //input iSides if(iSides != 4 || iSides != 6 || iSides != 8 || iSides != 10 //if || iSides != 12 || iSides != 20){ //user cout << "What? 4, 6, 8, 10, 12, or 20! \n"; //tamer }else{ //else conditional for good users break; //break loop } // }while(true); // if(iSides==4){ d4(iNumbr); } if(iSides==6){ d6(iNumbr); } if(iSides==8){ d8(iNumbr); } if(iSides==10){ d10(iNumbr); } if(iSides==12){ d12(iNumbr); } if(iSides==20){ d20(iNumbr); } }
Whats going on!!! ;_;[Linker error] undefined reference to 'WinMain@16'
Id returned 1 exit status



LinkBack URL
About LinkBacks



CornedBee