C++ Program for random number generator




Random number generator using C++

#include<iostream>
#include<time.h>
#include<stdlib.h>
#define MAX_NUM 10
using namespace std;
void randnum()
{
  int random;
  srand(time(NULL));
  for(int i=0;i<10;i++)
  {
    random=rand()%MAX_NUM;
    cout<<random<<endl;
  }
}
int main()
{
  cout<<"The ten random number are "<<endl;
  randnum();
  return 0;
}


/*
OUTPUT
The ten random number are
3
0
8
9
6
4
8
8
8
0

*/

Online computer science courses to jumpstart your future.
Different ways the Above question can be asked

  • Random number generator – C++
  • C++ Random Numbers
  • random function in c++
  • program to generate random numbers for a given range
  • C++ Random number generator
  • C++ Random Number Generator
  • Random number generator, C++
  • C++ – Random Number Generator
  • Generating Random Numbers in C and C++
  • Searches related to Generate random number in C++
  • generate random number C++
  • visual c++ generate random number
  • c++ generate uniform random number
  • c++ random number range
  • cpp random

 

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*