Hi all i'm new, I started learning a week or so ago and have joined to the forum so I can get some help and eventually contribute to the community. I am reading a number of books and online guides and have come across a problem I cannot solve when creating a simple coin flip randomizer.
#include <ctime>
#include <cstdlib>
#include <iostream>
using namespace std;
int choice;
int randRange (int low, int high)
{
return rand() % ( high - low ) + low;
}
int main ()
{
cout << "flip a coin? \n\n1: Yes\n\n2: No\n";
cin >> choice;
if (choice == 1)
{
srand ( time( NULL ) );
randRange( 1 , 10 );
if (randRange >= 5)
{
cout << "Heads";
}
else
{
cout << "Tails";
}
}
else if (choice == 2)
{
cout << "Boooo";
return 0;
}
}
I am getting a error on the if (randRange >= 5) line, the compiler says that c++ forbids a comparison between pointer and integer, but as far as I am aware I am not using a pointer.
reply's would be gratefully welcomed.