Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ / 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

New Trends In Databases And Information Systems Adbis 2019 Short Papers Workshops Bbigap Qauca Sembdm Simpda M2p Madeisd And Doctoral Consortium Bled Slovenia September 8 11 2019 Proceedings

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Robert Wrembel ,Mirjana Ivanovic ,Johann Gamper ,Mikolaj Morzy ,Theodoros Tzouramanis ,Jerome Darmont

1st Edition

3030302776, 978-3030302771

More Books

Students also viewed these Databases questions

Question

Question 5 of 9 Answered: 1 week ago

Answered: 1 week ago

Question

Assess three steps in the selection process.

Answered: 1 week ago

Question

Identify the steps in job analysis.

Answered: 1 week ago