Random Number Generation (Clock?)

The following code did not seem to work for me in Visual Studios C++ 2008.
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <cstdlib>
#include <time.h>
int main()
{
time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
cout << rand() << endl;
cout << rand() << endl;
cout << rand() << endl;
return 0;
}

I clearly 98% of it, and I don't understand why it is saying cout is undeclared. Help please.
*smiles* This is a mistake I once made when I was a novice and it took me five minutes to figure it out, so I'd recognize it anywhere. *shudders*

Quick fix:
using namespace std;
or preferably
using std::cout;

-Albatross
Last edited on
WOW. Thank you hahaha. Can't believe I missed THAT. I usually notice dumb things like that. Thank you though :).
Topic archived. No new replies allowed.