Write a C++ program that Take 10 integer inputs from user storing them in an array...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a C++ program that Take 10 integer inputs from user storing them in an array then: > Sorting the array in ascending order using Bubble sort : • • Write functions Bubble sort & Swap functions using pointer approach. The Bubble sort function should decrease number of comparisons every pass, make N-1 comparisons on the second pass, N-2 on the third pass, and so on. • A Sample of output as follow: Data items in original order 90 30 60 20 8 40 65 3 36 87 After pass 0: 30 60 20 8 40 65 3 36 87 90 After pass 1: 30 20 8 40 60 3 36 65 87 After pass 2: 20 8 30 40 3 36 60 65 After pass 3: 8 20 30 3 36 40 60 After pass 4: 8 20 3 30 36 40 8 3 20 30 36 3 8 20 30 3 8 20 After pass 5: After pass 6: After pass 7: After pass 8: 38 Data items in ascending order 3 8 20 30 36 40 60 65 87 90 Number of comparisons = 45 Press any key to continue... Write a C++ program that Take 10 integer inputs from user storing them in an array then: > Sorting the array in ascending order using Bubble sort : • • Write functions Bubble sort & Swap functions using pointer approach. The Bubble sort function should decrease number of comparisons every pass, make N-1 comparisons on the second pass, N-2 on the third pass, and so on. • A Sample of output as follow: Data items in original order 90 30 60 20 8 40 65 3 36 87 After pass 0: 30 60 20 8 40 65 3 36 87 90 After pass 1: 30 20 8 40 60 3 36 65 87 After pass 2: 20 8 30 40 3 36 60 65 After pass 3: 8 20 30 3 36 40 60 After pass 4: 8 20 3 30 36 40 8 3 20 30 36 3 8 20 30 3 8 20 After pass 5: After pass 6: After pass 7: After pass 8: 38 Data items in ascending order 3 8 20 30 36 40 60 65 87 90 Number of comparisons = 45 Press any key to continue...
Expert Answer:
Answer rating: 100% (QA)
include include usingnamespacestd voidSwapintxinty int temp temp x x y y temp intBu... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these algorithms questions
-
Georgia Jingles had the following listed on its 2 0 2 3 financial statements: sales of $ 9 5 , 2 6 8 , costs of $ 5 1 , 3 0 0 , depreciation of $ 9 , 8 0 0 , paid $ 1 1 , 3 3 0 in interest and...
-
Please do the following Matlab problem, 1.Write a for loop ranging from 3 to 5. In the loop, print the value of the loop index to the screen using fprintf in the following format: Value is n where n...
-
Write down a Python program that take 10 integer inputs from user and determine if all the numbers are different from each other, If user input/numbers are not different from each other it should ask...
-
The following inventory information is available for Ricci Manufacturing Corporation for the year ended December 31, 2017: Beginning Ending Inventories: Raw materials Work in process Finished goods...
-
A major problem in packaging very large-scale integrated (VLSI) circuits concerns cooling of the circuit elements. The problem results from increasing levels of power dissipation within a chip, as...
-
Describe the economic system based on private ownership of the means for production and the profits earned and is built on the principles of private property?
-
What difficulties do you think would be encountered in developing a computer program to implement the DUPLEX algorithm? For example, how efficient is the procedure likely to be for large sample...
-
How does deferred or unearned revenue arise? Why can it be classified properly as a current liability? Give several examples of business activities that result in unearned revenues.
-
Answer the following questions about the search problem shown above. For answering a path, please give your answers in the form 'A-D-G'. *Note: A is the initial state and G is the goal state. a) What...
-
Computer Project Exercises In developing the exercises, trade-offs had to be made to enrich the learning experience. One of the major problems students initially encounter is data and detail...
-
"The End of Accounting" and submit a summary and meaningful reflection of the reading and overall polished writing, single-spaced and should be between one and two pages. Does NOT need to be in...
-
How an excess demand function in the static Arrow-Hurwicz model is defined and what are its properties?
-
a. Greg was born on July 31, 1980. He is the only child of Bill and Karen. Under the terms of their separation agreement, which becomes effective on December 5, 1995, Bill is to have custody of Greg,...
-
a. The mother was ordered to promote the frequent and continuing positive interaction between the children and the father. Wouldnt this promotion constitute an expression of opinion by the mother? If...
-
Determine if a given utility function of a form: is (weakly) increasing or (weakly) decreasing. u: R R
-
Why are budget lines of the first and of the second traders in static Arrow- Hurwicz model identical (coincide)?
-
3. In the year 2000, specimens of Caulerpa taxifolia,a green alga used in tropical aquariums, were found off the coast of California. Native to the Indian Ocean, C. taxifolia is known for aggressive...
-
we have to compute the letter grades for a course. The data is a collection of student records stored in a file. Each record consists of a name(up to 20 characters), ID (8 characters), the scores of...
-
Write the statement to open a sequential access file named febSales.txt for output. The file is associated with the outFeb object.
-
Follow the instructions for starting C++ and viewing the SwatTheBugs22.cpp file, which is contained in either the Cpp8\Chap08\SwatTheBugs22 Project folder or the Cpp8\Chap08 folder. (Depending on...
-
If necessary, create a new project named Intermediate24 Project and save it in the Cpp8\Chap14 folder. Also create a new source file named Intermediate24.cpp. If you are using Microsoft Visual C++,...
-
Distinguish between a direct and an indirect acquisition.
-
What is the acquisition date?
-
Distinguish between a business combination and a non-business acquisition.
Study smarter with the SolutionInn App