Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Write a C++ program that generates a random number

#include<iostream>
#include<cstdlib>
#include
using namespace std;
main() {
   int max;
   max = 100; //set the upper bound to generate the random number
   srand(time(0));
   cout << "The random number is: "<<rand()%max;
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #Write #program #generates #random #number
ADD COMMENT
Topic
Name
3+3 =