Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add info(The string, fstream and sstream libraries are recommended. Be sure to include a blank list.txt in your submission) For this activity, you are required

Add info(The string, fstream and sstream libraries are recommended. Be sure to include a blank list.txt in your submission)

image text in transcribed
For this activity, you are required to provide files called act3.cpp as well as a makefile to compile and run it. In your file, act3.cpp, should have a skeleton of a main program as per normal which you will then fill it in as per the following. The objective of this activity is to demonstrate the bubble sort algorithm for arrays. You are going to implement this as a function with the following definition: string bubSort (double arr [8]) ; Your program will need to read in from a file called list.txt. On each line, will be a comma-delimited list of integer values. Each list will be 8 elements long. Your objective is to sort each of these lists using the bubble sort algorithm. Each line should be sorted, and then displayed in sorted (ascending order with the small- est element at the start of the string) one after the other. Each will be on a new line. As a hint, implementing a function to do the bubble sort itself will make the overall program easier to implement. For example: Given a list: 6.4,3.25,7.5,2.5, 1. 1, 11.6,0.5 The outcome of the sorting should be: 0.5, 1. 1,2.5,3.25,6.4,7.5, 11.6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

3. Could country of origin be used to help position the product?

Answered: 1 week ago