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 |
What is virtual base class uses?
What is c++ 11 and c++ 14?
What is function prototyping?
Discuss the possibilities related to the termination of a program before entering the mainq method?
List out some of the OODBMS available?
Implement strncpy
What is the purpose of ios::basefield in the following statement?
What are the advantages and disadvantages of using inline and const?
2 Answers Polaris, TCS, Zimmer Biomet,
Explain deep copy and a shallow copy?
Write a program which uses Command Line Arguments
What is abstract keyword in c++?
Explain operator overloading.