I had a look at the random numbers tutorial and was wondering why doesn't this work???
It says thet cout is unidentified, why's this?Code:#include <iostream>
#include <stdlib>
#include <time>
/*
These constants define our upper
and our lower bounds. The random numbers
will always be between 1 and 6, inclusive.
*/
const int LOW = 1;
const int HIGH = 3;
int main()
{
/*
Variables to hold random values
for the first and the second die on
each roll.
*/
int first_die, sec_die;
/*Ê
Declare variable to hold seconds on clock.
*/
time_t seconds;
/*
Get value from system clock and
place in seconds variable.
*/
time(&seconds);
/*
Convert seconds to a unsigned
integer.
*/
srand((unsigned int) seconds);
/*
Get first and second random numbers.
*/
first_die = rand() % (HIGH - LOW + 1) + LOW;
sec_die = rand() % (HIGH - LOW + 1) + LOW;
/*
Output first roll results.
*/
cout<<"I chose the mighty\n";
if ( first_die == 1 ) {
cout<<"Paper!\n";
}
else if ( first_die == 2 ) {
cout<<"Rock!\n";
}
else {
cout<<"Scisors!\n";
}
cout<<"I like the number "<< sec_die << "}" << endl << endl;
cin.get();
/*
Get two new random values.
*/
first_die = rand() % (HIGH - LOW + 1) + LOW;
sec_die = rand() % (HIGH - LOW + 1) + LOW;
/*
Output second roll results.
*/
cout<< "My roll is (" << first_die << ", "
<< sec_die << "}" << endl << endl;
cin.get();
}
Thanks