How to make a program in c++ that makes the user enter 4 numbers the program can arrange these numbers in assending and dis- | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to make a program in c++ that makes the user enter 4 numbers the program can arrange these numbers in assending and dis-

4th Dec 2018, 10:34 AM
A'mr 😒
A'mr 😒 - avatar
2 Answers
+ 4
Hello. In order to develop your skills, it is necessary to try yourself first, and then ask about any error or issue you face. That way, it will be better for everyone. Simply copying a code someone else made won't help you. Don't worry. Try, try until you succeed. Have a look at the guidelines, as they will make things clear: https://www.sololearn.com/discuss/1316935/?ref=app Just post your attempt if you are still unsure. Happy coding! The logic for the problem is simple. Store the numbers as an array, and sort it. Then print the numbers in the same order as in the array, and you get the ascending order. If you print in reverse, you get the descending order. For sorting, you can use std::sort. (www.cplusplus.com/reference/algorithm/sort)
4th Dec 2018, 10:48 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 3
A very simple, yet interesting assignment for all C++ beginners! This particular assignment helps learners to develop the necessary skills for implementing their list of data and the functionalities for rearranging, searching, and in general manipulating the data in a simple database. Also, Kinshuk's comment is really motivating and informative. 8)
4th Dec 2018, 11:04 AM
Babak
Babak - avatar