OneCompiler

can someone help me fix this code..

#include <iostream>
#include <cstdlib>
// Enable the use of rand()
using namesapce std;

int main()
{
int seedVal;

cin >> seedVal;
srand(seedVal)

int random =rand();

for (int count=0; count <=; ++count)

{cout << rand() << "\t";
// display random numbers per row if
(count % 1 == 0)
cout << "\n";}
}

1 Answer

4 years ago by

Try using this code:

#include <iostream>
#include <cstdlib>
// Enable the use of rand()
using namespace std;

int main()
{
  int seedVal;

  cin >> seedVal;
  srand(seedVal);

  int random =rand();

  for (int count=0; count <=seedVal; ++count)
  {
    cout << rand() << "\t";
    // display random numbers per row if
    if(count % 1 == 0)
    cout << endl;
  
  }
} 
4 years ago by Aton