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
Why use of template is better than a base class?
How many different levels of pointers are there?
How do you remove an element from a set in c++?
Why should we use null or zero in a program?
What is the full form of stl in c++?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create
What is the difference between ++ count and count ++?
What return value must conversion operators have in their declaration?
What is the use of object in c++?
How can an improvement in the quality of software be done by try/catch/throw?
Show the declaration for a static function pointer.
Explain register storage specifier.
What is the difference between *p++ and (*p)++ ?
the first character in the variable name must be an a) special symbol b) number c) alphabet
Why do we use classes in programming?