subject
Engineering, 14.12.2019 02:31 liddopiink1

Write a c++ program that will read all the integers from the provided file "numbers. txt" and then save them back to another file "sortednumbers. txt" in a sorted order. your code should load the provided file "numbers. txt". you will need to place this file "numbers. txt" in the same directory as your source. cpp file.

you will need to load all the numbers from the file and save them in an array. sort this array of numbers in ascending order. finally save this newly sorted array of numbers back into another file named "sortednumbers. txt".

your code only needs to work with this file. you can hard code the size of your integer array to 7. for example, int array[7].
expected operation:
numbers. text contents
5-8 7 2 10 4 15
sortednumbers. text contents
-8 2 4 5 7 10 15
hint : you can use any sorting algorithm of your choice in order to sort the loaded numbers
a. selection sort might be simpler
b. merge sort them if you want

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 04.07.2019 18:10
If a particle moves along a path such that r : (3 sin t) m and ? : 2t rad, where t is in seconds. what is the particle's acceleration in m/s in 4 seconds? a)- 16.43 b)- 16.29 c)- 15.21 d)- 13.79
Answers: 1
question
Engineering, 04.07.2019 18:10
At 12 noon, the count in a bacteria culture was 400; at 4: 00 pm the count was 1200 let p(t) denote the bacteria cou population growth law. find: (a) an expression for the bacteria count at any time t (b) the bacteria count at 10 am. (c) the time required for the bacteria count to reach 1800.
Answers: 1
question
Engineering, 04.07.2019 18:10
You are making beer. the first step is filling the glass carboy with the liquid wort. the internal diameter of the carboy is 15 in., and you wish to fill it up to a depth of 2 ft. if your wort is drawn from the kettle using a siphon process that flows at 3 gpm, how long will it take to fill?
Answers: 1
You know the right answer?
Write a c++ program that will read all the integers from the provided file "numbers. txt" and then s...
Questions
question
Social Studies, 30.01.2020 07:04
Questions on the website: 13722363