Hi, i was working on this for my class and i can't seem to get this to work. I am not quite done yet but i have a few problems. After my rules and game function, i would like it to return to the home screen (call the main) again but it dosen't seem to do that. When i click 1 for the rules it displays the rules then plays the game instead of returing home. Then i the random number dice are not number between 1 to 6. Why ? Thanks
Code:
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int Dice (int dice1, int dice2)
{
time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
dice1 = rand() % (5 + 1)+1;
dice2 = rand() % (5 + 1)+1;
return (dice1, dice2);
}
int rules()
{
system("cls");
cout << " The Rules Are Quite Simple. We Roll Two Dice.\n -If Even, Player 1 Gets a Point\n If Odd, Player 2 Gets a Point\n";
system("Pause");
int main ();
}
int game()
{
int times;
system("cls");
cout << "How Many Times Would You Like to Roll?";
cin >> times;
int Dice (int dice1, int dice2);
int main ();
}
int main()
{
int key;
cout << "Menu\n Press 1 for Rules\n Press Any Key to Play\n" ;
cin >> key;
if (key==1)
{rules();}
else
{game();}
int dice1;
int dice2 ;
cout << "First Dice = " << dice1 << endl;
cout << "Second Dice = " << dice2 << endl;
system("pause");
}