Exercise 6

September 27, 2019

Today’s task is a beginning programmer’s exercise from Bjarne Stroustrup’s book Programming: Principles and Practice Using C++:

Write a program that prompts the user to enter 3 integer values, and then outputs the values in numerical sequence separated by commas. So: if the user enters the values 10 4 6, the output should be 4, 6, 10. If two values are the same, they should just be ordered together. So, the input 4 5 4 should give 4, 4, 5.

Your task is to write the indicated program; you may use C++ or any other language, but your solution should be at the level of a beginning programmer who has not yet learned about arrays or user-defined functions. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


Pages: 1 2