0% found this document useful (0 votes)
2 views2 pages

C++ Bubble Sort Program Assignment

Uploaded by

dummyacc035
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

C++ Bubble Sort Program Assignment

Uploaded by

dummyacc035
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

C++ Coding Homework

Write a program to sort n number of random integers in ascending order using the bubble sort
algorithm. Run the code in online C++ compiler: [Link]

• The number of integers n must be user defined (input from the user during execution)

• Use the following to generate random integers from -1000 to 1000:


• C++ header needed for random numbers:
• C++ function to seed the rand() function:
• C++ statement to generate random integers:

• Encapsulate the data generation (array of random integers) and the bubble sort algorithm in a
class object.

• The main() should look like this:

1
C++ Coding Homework
• Test your code by inputting 10, 15, and 20 as the Input array size.
• The output should look like this:

Example 1: Example 2: Example 3:

You might also like