Need to fill in the two functions described below Themain routine is already pro
ID: 667673 • Letter: N
Question
Need to fill in the two functions described below
Themain routine is already provided for you. sort ( ) function from the STL is used to sort the contents of the vector. You are required to implement the following routines in your program: void genRndNums vector & v, int vec_size, int seed This routine generates vec size random integers and puts them in vector v. Initializes the random number generator (RNG) by calling the function srand ) with the seed value seed, and generates random integers by calling the function rand ().To use srand and rand, you need the header . * void printVec const vector & v, int vec size ) : This routine displays the contents of vector v (with size vec_size) on standard output, printing exactly NO_ITEMS12 numbers on a single line, except perhaps the last line. The sorted numbers need to be properly aligned on the output. For each printed number, allocate ITEM_w-5 spaces on standard outputExplanation / Answer
void printvec(char * name, double * x, int n){
int i;
printf("%s",name);
printf(": ");
for(i=0;i<n;i++){
printf("%f ",x[i]);
}
printf(" ");
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.