Home Forums C Programming Beginner Help Reply To: Beginner Help

#3240
S.Thananchayan
Participant

You need loop to hit random off system time

#include 
#include
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    string g,h="a";
    srand(time(0));
    loop:
    a = (rand()%10);
    b = (rand()%10);
    c = (rand()%10);
    d = (rand()%10);
    e = (rand()%10);
    f = (rand()%10);
    cout<<"n";
    cout << a;
    cout << b;
    cout << c;
    cout << d;
    cout << e;
    cout << f;
    cout<<"n";
    cout<<"n";
    cout<<"To create a new random number, press a and then enter.";
    getline (cin,g);
    if (g==h){
    goto loop;
    }
    cin.get();
}