Question: Need help with a c++ problem. #include //cin,cout #include //vectors #include //Format setw(),right using namespace std; //User Libraries Here //Global Constants Only, No Global Variables

Need help with a c++ problem.

Need help with a c++ problem. #include //cin,cout #include //vectors #include //Format

#include //cin,cout #include //vectors #include //Format setw(),right using namespace std;

//User Libraries Here

//Global Constants Only, No Global Variables //Allowed like PI, e, Gravity, conversions, array dimensions necessary const int COLMAX=2;//Only 2 columns needed, even and odd

//Function Prototypes Here void read(vector &, vector &); void copy(vector, vector,int [][COLMAX]); void prntVec(vector, vector,int);//int n is the format setw(n) void prntAry(const int [][COLMAX],int,int,int);

//Program Execution Begins Here int main(int argc, char** argv) { //Declare all Variables Here const int ROW=80; //No more than 80 rows int array[ROW][COLMAX]; //Really, just an 80x2 array, even vs. odd vector even(0),odd(0); //Declare even,odd vectors //Input data and place even in one vector odd in the other read(even,odd); //Now output the content of the vectors // setw(10) prntVec(even,odd,10);//Input even, odd vectors with setw(10); //Copy the vectors into the 2 dimensional array copy(even,odd,array); //Now output the content of the array // setw(10) prntAry(array,even.size(),odd.size(),10);//Same format as even/odd vectors //Exit return 0; }

setw(),right using namespace std; //User Libraries Here //Global Constants Only, No Global

Purpose: Input numbers and segregate them by placing their values into even or odd vectors based upon their value being even or odd. Thenl a 2-D array with the tirst column containing the contents ot the even vector and the second column containing the odd vector. Output the result and display the contents of the vectors and array. See the sample case for the format of the output. YOUR

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!