Question: IN C++ In this part write first a C++ program called randNumA.cppwhich do the following; It receivesfour(4+1) items upon activationof the programthrough the argv[the argument

IN C++

In this part write first a C++ program called randNumA.cppwhich do the following; It receivesfour(4+1) items upon activationof the programthrough the argv[the argument vector]:[Note that default item is zero (0) which is the name of the executable program.]1.The 1stitem is a the nameof a data file[e.g. datafileA.txt]2.The 2nditem refers tonumberof items [e.g. 20] this program should generate3.The 3rditem refers torangeof the numbers [e.g. 1-1000]4.The 4thitem refers to seedof the random number generator [e.g. 3127]

Code to change.

#include #include #include #include

using namespace std; int main ( int argc, char* argv[] ) { //Declaring variables string name; int number,range,seed;

//Getting the values from the command line arguments name=argv[1]; number=atoi(argv[2]); range=atoi(argv[3]); seed=atoi(argv[4]);

//Setting the seed value srand(seed);

ofstream dataOut; //Opening the output file dataOut.open(name.c_str());

//Writing the random nundom numbers to the output file for(int i=0;i

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!