So I am creating a random number generator and I keep getting a problem. In my program I have it print out the code into the "int main()" function. The problem is that it prints a 0 after. It's also saying I have to use return, but I don't want to. I want to keep the random number generator in another function because I will be adding much more in the future.
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int randRoll();
//Calls the other function
int main()
{
cout << randRoll() << endl;
system("Pause");
}
//Gets the random number
int randRoll()
{
srand(time(0));
for (int x = 1; x <= 1; x ++)
{
cout <<"Your random number is " << 1 +(rand()%4) << endl;
}
return 0;
}