Jump to content

reubenhyman

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by reubenhyman

  1. reubenhyman

    C++

    when I place the == comparison operator and comment out the break instead of = it only displays 1 number does not show second number
  2. reubenhyman

    C++

    Just getting into C++ I'm experimenting with random number generator How is it that I would sometimes get the same number? srand(time(0)); I have int as int randNumb1 = 0; int randNumb2 =0; so it do this randNumb1 = (rand() % 20) +1; cout << "First Random number is " << randNumb1 << endl;; randNumb2 = (rand() % 20) +1; while (randNumb1 = randNumb2) { randNumb2 = (rand() %20) +1; cout << "Second number is " << randNumb2 << endl;; // terminate the loop break; }
×
×
  • Create New...