Mar 9, 2016 at 2:46am Mar 9, 2016 at 2:46am UTC
Hi All,
I've created a code that prompts the user that the vectors in the main function are identical or not. Now I'd like to make this a function where it will prompt the user if the vectors are identical by a true or false statement.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> vectorIdentity, Vectoridentity;
vectorIdentity.push_back(1);
vectorIdentity.push_back(2);
vectorIdentity.push_back(3);
vectorIdentity.push_back(4);
vectorIdentity.push_back(5);
Vectoridentity.push_back(1);
Vectoridentity.push_back(2);
Vectoridentity.push_back(3);
Vectoridentity.push_back(4);
Vectoridentity.push_back(5);
if(vectorIdentity == Vectoridentity)
{
cout << "The two vectors are equal.";
}
else
{
cout << "The two vectors are not equal.";
}
return 0;
}
Mar 10, 2016 at 4:08am Mar 10, 2016 at 4:08am UTC
Does IsEqual need to be a boolean?