Name: Anonymous 2007-12-11 11:33
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
main()
{
time_t sec;
time(&sec);
srand((unsigned int) sec);
int rand();
int dice = rand()%6 +1;
int junkdata;
cout << "\n" << dice;
cin >> junkdata;
return 0;
}
Errors are.
[linker error] undefined reference to 'rand()'
and
Id returned 1 exit status.
everyones gotta learn somewhere. so don't troll much please. :/
also.
what do I use to make the program stay open when i'm testing it, currently i'm using an input just so it waits for that last input >_>.
surely thats not the way to do it? thanks.
#include <cstdlib>
#include <time.h>
using namespace std;
main()
{
time_t sec;
time(&sec);
srand((unsigned int) sec);
int rand();
int dice = rand()%6 +1;
int junkdata;
cout << "\n" << dice;
cin >> junkdata;
return 0;
}
Errors are.
[linker error] undefined reference to 'rand()'
and
Id returned 1 exit status.
everyones gotta learn somewhere. so don't troll much please. :/
also.
what do I use to make the program stay open when i'm testing it, currently i'm using an input just so it waits for that last input >_>.
surely thats not the way to do it? thanks.