please help. what is missing? Function: This program follows this algorithm: // (1) Read an integer value Num from the k

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

please help. what is missing? Function: This program follows this algorithm: // (1) Read an integer value Num from the k

Post by answerhappygod »

please help. what is missing?
Function: This program follows this algorithm:
// (1) Read an integer value Num from the keyboard.
// (2) Open an input file named 'second'.
// (3) Read three integer values from the file.
// (4) Compute the sum of the three values.
// (5) Add Num to the sum.
// (6) Display the sum.
//
//
--------------------------------------------------------------------------

#include
#include
#include
using namespace std;
int main()
{
// ****** The lines put data into two input files.
system("rm -f first; echo 7 2 5 4 8 > first"); //DO NOT TOUCH
...
system("rm -f second; echo 21 7 2 9 14 > second"); //DO NOT
TOUCH ...
//
--------------------------------------------------------------------

// WARNING: DO NOT ISSUE PROMPTS or LABEL OUTPUT.
//
--------------------------------------------------------------------

ifstream infile;
infile.open("second");
int a, s, d, sum;
infile >> a >> s >> d;
sum = a+s+d;S
cout << sum;
cout << endl; return 0; // DO NOT MOVE or DELETE.
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply