Question: Define a function isSmaller ( ) that takes two integer vector parameters. The function returns true if the two vectors have the same size, and
Define a function isSmaller that takes two integer vector parameters. The function returns true if the two vectors have the same size, and every element in the first vector is less than the element at the same index in the second vector. The function returns false otherwise.
Ex: If the input is:
then the first vector has elements and the second vector has elements The output is:
False, the first vector is not elementwise less than the second vector.
Please write in C
#include
#include
using namespace std;
Your code here!
int main
int i;
vector inputVector;
vector inputVector;
int size;
int input;
bool checkProperty;
cin size;
for i ; i size; i
cin input;
inputVectorpushbackinput;
cin size;
for i ; i size; i
cin input;
inputVectorpushbackinput;
checkProperty isSmallerinputVector inputVector;
if checkProperty
cout "True, the first vector is elementwise less than the second vector." endl;
else
cout "False, the first vector is not elementwise less than the second vector." endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
