#include #include Write the output of the following program in the box provided below. using namespace...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
#include <iostream> #include <fstream> Write the output of the following program in the box provided below. using namespace std; int fun_one(int, int, string&); int main() { int num1, num2, sum; string test; ifstream fin; fin.open("exam. txt"); if (fin.fail()) { cout << "File error" << endl; return -1; } fin >> num1 >> num2; first record while (!fin.eof()) { Calling sum fun_one(num1, num2, test); cout << "sum = " << sum << fin >> num1 >> num2; } return 0; } int fun_one(int n, int n2, string& t) 4₁ { 2 8 3 10 5 7 9 int total (0), x(0); static int z(0); Z++; X = x + 2; cout << "2= " << Z << endl; total= n1 + n2; } if (total % 2 == 0) { else. { - "valid"; cout << "x = " << x << endl; total= -99; t="invalid"; return total; input line: << test << endl; 12 4-6 Input File (exam.txt) 24 83 10 5 79 Show the output of the given program in this box Z= #include <iostream> #include <fstream> Write the output of the following program in the box provided below. using namespace std; int fun_one(int, int, string&); int main() { int num1, num2, sum; string test; ifstream fin; fin.open("exam. txt"); if (fin.fail()) { cout << "File error" << endl; return -1; } fin >> num1 >> num2; first record while (!fin.eof()) { Calling sum fun_one(num1, num2, test); cout << "sum = " << sum << fin >> num1 >> num2; } return 0; } int fun_one(int n, int n2, string& t) 4₁ { 2 8 3 10 5 7 9 int total (0), x(0); static int z(0); Z++; X = x + 2; cout << "2= " << Z << endl; total= n1 + n2; } if (total % 2 == 0) { else. { - "valid"; cout << "x = " << x << endl; total= -99; t="invalid"; return total; input line: << test << endl; 12 4-6 Input File (exam.txt) 24 83 10 5 79 Show the output of the given program in this box Z=
Expert Answer:
Answer rating: 100% (QA)
The program in question is reading input from a file named examtxt which contains pairs of integers ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
The average distance between Earth and the Sun is 1.5 10 m. 1) Calculate the average speed of Earth in its orbit (assumed to be circular) in meters per second. 2) What is this speed in miles per hour?
-
Please complete the 2014 federal income tax return for Jonathan Hales. Be sure to include only required tax forms when completing the tax return. Ignore the requirement to attach the form(s) W-2 to...
-
In Exercises use a graphing utility to graph the function and find the absolute extrema of the function on the given interval. f (x) 2 2-x [0, 2)
-
Show the function and location of the following in the boiler plant: (i) Feed check valve (ii) Air superheater, and (iii) Fusible plug.
-
An investor is considering the purchase of a property for $1 million. Based on the $1 million price, the property has a cap rate of 10.5%. The investor can obtain an interest-only mortgage loan at...
-
1) What is the mechanism of C-H Amination ? 2) What are the limits of C-H Amination ?
-
A chemical constituent flows between three reactors as depicted in Fig. P11.15. Steady-state mass balances can be written for a substance that reacts with first-order kinetics. For example, the mass...
-
solve just the number 3 real quick for this problem using java language S since the algorithm computes each Fibonacci number, numerous times. The algorithm is inefficient because it has too many...
-
8. The copper coil has a resistance of 0.25 02 at 75 "C. If the coil is cooled to 20 C as shown in fig (8), the reading of voltmeter will be Beaker V water Fig(8) A I= 0.9 Amp Coil (Copper)
-
A damaged Hawker Hunter fighter jet needs to get off the ground to continue the good fight. It has a mass of 3,205 kg and it reaches a cruising altitude of 6,782 m in 85 s with a max speed of 327...
-
A surveyor measures the distance across a straight river by the following method: Starting directly across from a tree on the opposite bank, he walks x = 112 m along the riverbank to establish a...
-
1) An object of mass 40 kg is being acted upon by two forces in the x-direction. The first force, F1, has a magnitude of 10 N, while the second force, F2, has a magnitude of 12 N. Additionally, there...
-
Consider the circuit a 130 V 3 F 3 F C 4 F 4 F H b What is the equivalent capacitance for this network? Answer in units of F.
-
Implicit changes of requirements are permitted during____________.
-
The Dow Jones Industrial Average reached a high of $ 7801.63 on December 29, 1997. Recall from Example 18.4 that it reached a high of $ 1003 on November 14, 1972. The Consumer Price Index for...
-
In this exercise, you modify the program from TRY THIS Exercise 8. If necessary, create a new project named ModifyThis9 Project and save it in the Cpp8\Chap15 folder. Copy the instructions from the...
-
In this exercise, you will experiment with the switch statement. a. Follow the instructions for starting C++ and viewing the Advanced20.cpp file, which is contained in either the...
-
Complete Figure 5-34 by writing the algorithm and corresponding C++ instructions. Employees with a pay code of 1, 4, or 9 receive a 4.5% raise; all other employees receive a 3.5% raise. If necessary,...
-
Consider a European-style derivative, depending on ST , the price of a non-dividend-paying stock share at time T, characterized by the payoff depicted in the figure below. 15 5 Payoff 10 20 20 30 35...
-
Let us consider a European-style put option on a non-dividend-paying asset whose price follows a GBM with drift 10% and volatility 40% (annualized). The risk-free rate is 5% with continuous...
-
Using the FeynmanKac representation theorem, solve the PDE for an unknown function V (x, t) with terminal condition 1 +ax- It + bx 202V = 0,
Study smarter with the SolutionInn App