someguy88 19 Newbie Poster

Please help me im having trouble with a dice roller im making.

Its kind of working except i was wondering why it is that every time i start it up it always throws up the same numbers in a row if you put in 100. It probably does that with other numbers to but i haven't checked them.

Anyhow i was wondering if someone could suggest a way to make it actually random, if its possible in C++ and C.

Any suggestions in just imporving it are welcome to :icon_cheesygrin: THANKS ALL.

#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;

void loop_q();


int main()
{
    
int dice;

system("cls"); 

           cout << "What would you like your dice out of: " << endl;
           cout << "(100, 10, 6, 4 ect..)" << endl;
           cin >> dice;
    
    int rand_number = rand() % dice + 1;

system("PAUSE");   
system("cls"); 

               cout << "Roll: " << rand_number << endl;
               cout << endl;
loop_q();
}    

void loop_q()
{
      cout << "Would you like to roll again? y/n." << endl;   
        
      char answer;
      cin >> answer;

if (answer=='y') 
{
main();   
}

else
{
return;
}

}
Ancient Dragon commented: Thanks for using code tags +19