Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please! Enter firet sequence (Qwhen done): 1 1 2 2 3 3Q Enter second sequence (Q when done): 1 2 3 3 2 1

C++ please!

image text in transcribed

Enter firet sequence (Qwhen done): 1 1 2 2 3 3Q Enter second sequence (Q when done): 1 2 3 3 2 1 0 These are: Same Exercise 2: Same Elements (This is essentially Exercise P6.10 of the book) Write a program sameelements.cpp that takes in two sequences of positive integers and checks whether they have the same elements in some order, now taking duplicates into consideration. For example, the two sequences 1 4 9 16 9 7 4 9 11 and 11 1 4 9 16 9 7 49 would be considered identical. But Enter first sequence (Q when done) 1 1 1 1 0 Enter second sequence (Q when done): 111Q These are: Different 1 4 9 16 9 7 4 9 11 Note: Assume the user inputs at least 1 positive integer per sequence before Q. Note on formatting: We'll stress again - please have the formatting like the above examples. Make sure to have colons. No invalid inputs: You do NOT have to worry about the user giving invalid inputs like characters (except for Q), really large numbers, etc. and 11 11 7 9 16 4 1 4 9 would not. You may consider typing up one or more functions to help organize things. Assume the user inputs at least one positive integer for each sequence. Hints: You may not use stdafx.h . You may want to do cin.clear(); string discard cin >> discard; before reading input for the second sequence of numbers. Can you explain why? See Special Topic 4.1 in Section 4.5 (or slide 22 of the Chapter 4 lecture slides). If the two sequences of numbers do NOT have the same length, then they are automatically different Please have the output formatted exactly like the following examples: Enter first sequence (Qwhen done): 1 2 2 3 3 3 Q Enter second sequence (Q when done): 1 2 3 Q These are: Different

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions