Can someone tell me what I am doing wrong. I have so many errors I dont know where to begin.
Code:
#include <iostream.h>
#include "random.h"
int main()
{
int die1, die2, dietotal, pointstaken, pointsrisked, userpoints=1000, temp, totalpoints;
cout <<"Welcome to the Dice Program. Press 0 to exit or any other key to begin " <<;
cin >> temp;
if (temp == 0){
break;
else;
cout <<"You have " << userpoints << " points." << endl;
cout <<"How many points do you want to risk: " <<;
cin >> pointsrisked; //get risked points
die1 = 1 + random(5) //generate random number as dice roll
die2 = 1 + random(5) //generate random number as dice roll
dietotal= die1 + die2 //calculate dice total
if ((dietotal % 2) ==0){ // determines if dice total is even or odd number
totalpoints = (userpoints - pointsrisked);
userpoints = totalpoints;
cout << "You rolled a " << die1 << " and " << die2 endl;
cout << "You Lose" endl;
cout <<"You now have " << userpoints << " points." << endl;
else;
totalpoints = (userpoints +(pointsrisked * 2));
userpoints = totalpoints;
cout << "You rolled a " << die1 << " and " << die2 endl;
cout << "You Win" endl;
cout <<"You now have " << userpoints << " points." << endl;
}
}
return (0);
}
Here is the code from my random.h file
Code:
#include <iostream.h>
#include <stdlib.h>
//--------RANDOM LIBRARY--------------
//------------------------------------
#if defined(_MSC_VER)
#include <stdlib.h>
#include <time.h>
void randomize()
{
time_t t;
srand((unsigned) time(&t));
}
//------------------------------------
int random(int limit)
{
return rand()%limit;
}
#endif
//------------------------------------
//----END OF RANDOM LIBRARY-----------
please help.