Question: Write a C++ program that takes in two sequences of positive integers and checks whether they have the same elements in some order, ignoring duplicates.
Write a C++ program that takes in two sequences of positive integers and checks whether they have the same elements in some order, ignoring duplicates.
For example, the two sequences
1 4 9 16 9 7 4 9 11
and
11 11 7 9 16 4 1
would be considered identical. Consider typing up one or more functions to help organize things.
- Assume the user inputs at least one positive integer for each sequence.
- Assume the user inputs at least 1 positive integer and a maximum of 10 integers
- You may not use stdafx.h or
- (use iostream in code)
- Do cin.clear();
string discard;
cin >> discard;
- Example of format:s
Enter first sequence ( Q when done ) : 1 4 9 16 9 7 4 9 11 Q
Enter second sequence ( Q when done ) : 11 11 7 9 16 4 1 Q
These are : Same
-----------------------------------------------------------------------------
Enter first sequence ( Q when done ) : 1 2 3 Q
Enter second sequence ( Q when done ) : 1 2 Q
These are : Different
------------------------------------------------------------------------------
Enter first sequence ( Q when done ) : 1 1 1 Q
Enter second sequence ( Q when done ) : 1 Q
These are : Same
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
