Name: Anonymous 2010-11-05 22:55
Hurr, getting into the basics of C++ here, and running into issues with calling user defined functions more often that I feel I should. I wrote a mock program to test the issue, and I'm still running into trouble:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
int randGen ();
int main ()
{
srand ( time ( 0 ) );
cout << randGen;
cin.ignore().get();
return EXIT_SUCCESS;
}
int randGen ()
{
srand ( time ( 0 ) );
return ( 1 + rand ( ) % 10);
}
It compiles, but it tells me "[Warning] the address of `int randGen()', will always evaluate as `true' " and the only thing it outputs is "1" when I want it to output a random number between 1 and 10.
help?
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
int randGen ();
int main ()
{
srand ( time ( 0 ) );
cout << randGen;
cin.ignore().get();
return EXIT_SUCCESS;
}
int randGen ()
{
srand ( time ( 0 ) );
return ( 1 + rand ( ) % 10);
}
It compiles, but it tells me "[Warning] the address of `int randGen()', will always evaluate as `true' " and the only thing it outputs is "1" when I want it to output a random number between 1 and 10.
help?