I'm trying to create a program that creates random numbers. I looked through some examples and this is what I came up with. The time identifier seems to be undefined yet I see no reason it is undefined. please help!
here's my error code..Code:#include "stdafx.h" #include <iostream> using namespace std; int main() { //Re-seed the random-number generator time_t now; time(&now); srand(now); rand(); //Print out a list of random numbers for (int i=0;i<5;i++) { cout << rand() % 100 << endl; } system("pause"); return 0; }
1>------ Build started: Project: bake, Configuration: Debug Win32 ------
1> bake.cpp
1>c:\users\jonbecher\documents\visual studio 2012\projects\bake\bake\bake.cpp(8): error C3861: 'time': identifier not found
1>c:\users\jonbecher\documents\visual studio 2012\projects\bake\bake\bake.cpp(9): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Reply With Quote

Bookmarks