In this C++ project, we will see the random array generation means random values are generated and inserted into the array.
First, you can download the source code and unzip it to use. U can run this source code on any platform like Visual Studio Code, Dev c++, etc.
The rand() function will generate random number.
For integer data: I_elements = rand() % 100; //It generate random number between 0 to 99
For floating data: F_elements = (rand() / 7.5); We can't generate floating numbers directly, so we have to divide the rand() function with any floating-point number to generate a random float number.
Labels are used as targets for the goto statement.
Random: //the label is used instead of loops and switch goto Random; //goto keyword is used to jump to a specific label
I_count and F_count variables are used as a counter location for array elements
Need to specify the size of the array as shown below.
select choice for the integer data type.
select choice for the float data type.
Submitted by Shubham Chandrakant Shinde (Shubham25)
Download packets of source code on Coders Packet