Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Write a program that takes 5 integers array as input. you have to ensure that user enter these arrays in ascecding order, if user enters correctly display a prompt to "Read input in correct format" and input again. Write c++ programe to produce an array that merges elements of all arrays in descending order, but also needs to remove duplicates.

What I have tried:

tried to output correctly but neither input is right nor output
Posted
Updated 24-Nov-22 0:45am
Comments
Dave Kreskowiak 15-Nov-22 16:17pm    
Well, if the input isn't correct, the output isn't going to be either. It's not like you're going to be to write code that predicts what the correct answer should be based on bad input.

If you want help with your code, you're going to have to show your code and describe what the problem is.

We won't do the coding for you, but maybe this will get you started:
Merge Sort Array - C++ Programming Question[^]
If you get stuck, ask again :)
 
Share this answer
 
Comments
CPallini 16-Nov-22 2:35am    
Well, it look to me that 'merge sort' is not required here.
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Comments
CPallini 16-Nov-22 2:35am    
5.
Quote:
tried to output correctly but neither input is right nor output

The output depends on the input. Unfortunately we don't know why the input is not correct, because an explanation and also source code is missing here. I suggest to take care of correct input first. For this a function would be recommended, which can then be called several times. If I understand the task correctly, each number should be checked directly after the input. Presumably, improper inputs should be ignored and the input repeated until an array is full. Usually some things can go wrong with user input.
 
Share this answer
 
v2
Comments
CPallini 16-Nov-22 2:35am    
5.
merano99 16-Nov-22 11:24am    
Thx
By coincidence just a few hours ago I learned of this https://www.fq.math.ca/Scanned/8-1/lynch.pdf[^] Perhaps it would be helpful
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900