Question: / / Test 4 . cpp : Defines the entry point for the console application. / / #include stdafx.h #include #include #include #include using

// Test4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
#include
#include
#include
using namespace std;
void OutVector(const vector &);
void InVector(vector &);
int main()
{
vector X1(10);
vector X2(20);
srand (time(0));
cout << "Size of X1 Vector : "<< X1.size()<< endl;
cout << "Size of X2 Vector : "<< X2.size()<< endl;
OutVector(X1);
OutVector(X2);
cout <<"X1 new values:" << endl;
InVector(X1);
OutVector(X1);
cout <<"X2 new values:" << endl;
InVector(X2);
OutVector(X2);
X2[4]=100;
OutVector(X2);
X1= X2;
cout << "New X1"<< endl;
OutVector(X1);
vector X3(X2);
cout << "New X3"<< endl;
OutVector(X3);
X3.at(2)=200;
cout << "New X3"<< endl;
OutVector(X3);
vector X4(30);
return 0;
}
void OutVector(const vector &Y)
{
size_t i;
for ( i =0; i < Y.size(); i++)
cout << setw(4)<< Y[i];
cout << endl;
}
void InVector(vector &Y)
{
for (size_t i =0; i < Y.size(); i++)
Y[i]=1+rand()%50;
}

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!