Bubble Sort with Before and After

Medium

Read an integer N followed by N integers into an array, print the array under the heading given array:, sort it into ascending order with bubble sort, and print it again under the heading sorted array:. Each heading is followed by a space and then the elements separated by single spaces, with no trailing space: given array: 5 1 4 2 8 and sorted array: 1 2 4 5 8. N must be between 1 and 100; otherwise print N must be between 1 and 100 and return 1. If N or any value cannot be read, print invalid input and return 1.

Success Criteria

Your code must pass 7 test case(s) to complete this exercise. 3 hint(s) are available if you need help.

Sign in to track your progress

You can work on exercises as a guest, but sign in to track your progress and save your submissions.

This platform is built by its community

Every lesson, project, and tool on HelloC++ is funded by sponsors. Join them and help shape what we build next.

Become a Patron

How did you find this exercise?

Your rating helps us improve the content.