Write a code segment that reads an int value fromeach of two files, infile1 and
ID: 3615045 • Letter: W
Question
Write a code segment that reads an int value fromeach of two files, infile1 andinfile2. If neither file is in the failstate, the program writes the lesser value of the two to a filecalled outfile, and reads another value from thefile that had the lesser value. If either of the files is inthe fail state, then the value from the file that is not in thefail state is written to outfile. If bothfiles are in the fail state, then an error message is output tocout. The int values can be input intovariables value1 and value2.Explanation / Answer
please rate - thanks hope this is what you're looking for! infile1>>value1; infile2>>value2; if(infile1.fail()&&infile2.fail() ) //both fail coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.