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 can’t you call invariants() as the first line of your constructor?
What are pointer-to-members in C++? Give their syntax.
Can we use clrscr in c++?
What kind of jobs can I get with c++?
Is c++ the hardest programming language?
Which is better c++ or java?
How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?
Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers
Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work
what are the types of Member Functions?
What are the data types in c++?
If a header file is included twice by mistake in the program, will it give any error?
What is a constant reference?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
What is the difference between a baller and a reference in C++?