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 |
How to declare a function pointer?
What are the different types of variables in C++?
how to connect with oracle 9i with server in socket program in c/c++
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
What is the difference between an array and a list?
What happens when you make call 'delete this;'?
Is c++ double?
When we use Abstract Class and when we use Interface?where we will implement in real time?
Which operator cannot be overloaded c++?
What are the different types of polymorphism?
Write about the use of the virtual destructor?
Refer to a name of class or function that is defined within a namespace?