Write a C++ Program to Generate Random Numbers between 0 and 100
Solution:
/* C++ Program to Generate Random Numbers between 0 and 100 */
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int i; //loop counter
int num; //store random number
cout<<"Generating Random Numbers Below ::
";
for(i=1;i<=10;i++)
{
num=rand()%100; //get random number
cout<<" "<<num<<" ";
}
cout<<"
";
return 0;
}
Output:
/* C++ Program to Generate Random Number between 0 and 100 */
Generating Random Numbers Below ::
41 67 34 0 69 24 78 58 62 64
Process returned 0
| Is This Answer Correct ? | 0 Yes | 0 No |
If there are two catch statements, one for base and one for derived, which should come first?
What do the keywords volatile and mean mutable?
What is c++ similar to?
What is meant by iomanip in c++?
Can a program run without main?
Is c++ a float?
Write a program to get the value of sin (x) using a library function , when x is given in degrees.
How do you clear a buffer in c++?
What is the difference between const and constexpr?
Why is c++ not purely object oriented?
Can we change the basic meaning of an operator in c++?
Disadvantages of c++