Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that asks the user to enter a sequence ofintergers and then writ

ID: 3617663 • Letter: W

Question

Write a program that asks the user to enter a sequence ofintergers and then writes those intergers to a file with thenumbers seperated by one or more blank spaces.(Note: you couldeasily create such a file using a text editor but this gives youpractice writing to a file). This program doesnot have to sort thenumbers, just write them out as input. however, you can use thisprogram to create the files for part2. Write a seperate program that merges the numbers in two filesand writes the numbers into a third file. Each input file containsa list of of intergers in sorted (ascending) order. The output filewill contain the numbers from the input files in sorted order. Forexample, if the first file contains 1 3 11 and the second filecontains 2 9 10 12 20 then the merges file will contain 1 2 39 10 12 20. Create a function called file_merge to merge the files. Filestream objects can be used as parameters in a function header butthey must be reference parameters. there fore the declaration of the function will be, void file_merge(ifstream &f1, ifstream &f2, ofstream&f3); Your main () function should declare ifstream objects, openthe two input files, declare an ofstream object, open an utputfile, and call the file_merge function to complete the task. useyour program form part1 to create sorted inut files. be sure totwst your program using input files with the same and differentnumbers of intergers. Write a program that asks the user to enter a sequence ofintergers and then writes those intergers to a file with thenumbers seperated by one or more blank spaces.(Note: you couldeasily create such a file using a text editor but this gives youpractice writing to a file). This program doesnot have to sort thenumbers, just write them out as input. however, you can use thisprogram to create the files for part2. Write a seperate program that merges the numbers in two filesand writes the numbers into a third file. Each input file containsa list of of intergers in sorted (ascending) order. The output filewill contain the numbers from the input files in sorted order. Forexample, if the first file contains 1 3 11 and the second filecontains 2 9 10 12 20 then the merges file will contain 1 2 39 10 12 20. Create a function called file_merge to merge the files. Filestream objects can be used as parameters in a function header butthey must be reference parameters. there fore the declaration of the function will be, void file_merge(ifstream &f1, ifstream &f2, ofstream&f3); Your main () function should declare ifstream objects, openthe two input files, declare an ofstream object, open an utputfile, and call the file_merge function to complete the task. useyour program form part1 to create sorted inut files. be sure totwst your program using input files with the same and differentnumbers of intergers.

Explanation / Answer

x.X cellpadding="0" cellspacing="0" border="0"> Question Details: Write a program that asks the user to enter a sequence of intergers and then writes those intergers to a file with the numbers seperated by one or more blank spaces.(Note: you could easily create such a file using a text editor but this gives you practice writing to a file). This program doesnot have to sort the numbers, just write them out as input. however, you can use this program to create the files for part2. Code of this part is given below:- #include #include using namespace std; int main() { int count,num; ofstream outputfile; outputfile.open("data.txt", ios::app); if(outputfile.fail()) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote