Write a C++ Program to Generate Random Numbers between 0 and 100
Answer Posted / hr
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 |
Post New Answer View All Answers
Define a nested class.
When you overload member functions, in what ways must they differ?
Is it possible to get the source code back from binary file?
What flag means?
what is oops and list its features in c++?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
How do I use arrays in c++?
How do you generate a random number in c++?
Is dev c++ a good compiler?
What is stream and its types in c++?
Explain virtual class?
How is computer programming useful in real life?
What is lvalue?
Can you be able to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?