#include <iostream>
#include <string>
#include <ctime> //it is <ctime> in the standard library
usingnamespace std;
int main()
{
srand(time(nullptr)); //use nullptr
int x = 6; //Initialization
cout << " * NUMBERS * ";
cout << "You need atleast two players and one six-sided die ";
cout << " - INSTRUCTIONS - " <<endl;
cout << " 1. Take turns rolling all three die" <<endl;
cout << " 2. Add the numbers up" <<endl;
cout << " 3. If the sum is an even number you get two points, if it is odd you get one point" <<endl;
cout << " 4. First peron to 10 points wins!" <<endl;
cout << rand() % x+1;
int v;
v=rand() % x+1; //I would recommend using C++14 random number
//generation, but you probably haven't learned that yet. So this is fine.
if ( v==1|| v==3|| v==5 )
cout << "Congratulations , YOU GET ONE POINT!";
elseif ( v==2 || v==4 || v==6 )
cout << "Congratulations , YOU GET TWO POINTS!u ";
}
#include <iostream>
#include <cstdlib> // YOU NEED THIS
#include <string>
#include <time.h>
usingnamespace std;
int main()
{
srand(time(NULL));
int x,v ;
x = 6;
cout << " * NUMBERS * ";
cout << "You need atleast two players and one six-sided die ";
cout << " - INSTRUCTIONS - " <<endl;
cout << " 1. Take turns rolling all three die" <<endl;
cout << " 2. Add the numbers up" <<endl;
cout << " 3. If the sum is an even number you get two points, if it is odd you get one point" <<endl;
cout << " 4. First peron to 10 points wins!" <<endl;
v=rand() % x+1;
cout << "random number is: " << v << endl;
if ( v==1|| v==3|| v==5 )
{
cout << "Congratulations , YOU GET ONE POINT!";
}
if ( v==2 || v==4 || v==6 )
{
cout << "Congratulations , YOU GET TWO POINTS! " << endl;
}
}