#include using namespace std; #define SIZE 10 void main () int i, number[SIZE], sum; sum = 0; for (i = 0; i < SIZE; i++) { cin >> number[i]; sum += number[i]; cout << "\nThe sum of the numbers is "; for (i = 0; i < SIZE; i++) { if (i != SIZE - 1) cout << number[i] << " + "; else cout << number(i] << " = "; cout << sum; Modify sum.cpp so that the user input the array elements number[i] from a text file and prints out the output onto a text file as well. Use the C++ functions/identifiers provided in the header file . Create an input file ("numbers.txt") to store any 10 integers. Make sure this file is saved in the same folder as the sum.cpp file. Use the following data in the input file: 4 7 25 6 1 6 5 1 4 Use the output file name as "output.txt". This file will be created automatically after the successful running of the above program. The output in this file will be: The sum of the numbers is 4 + 7 + 2 + 5 + 6 + 1 + 6 + 5 + 1 + 4 - 41

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
A Lab 9.pdf - Adobe Acrobat Reader DC
File Edit View Window Help
Home
Tools
Lab 9.pdf
Sign In
1 / 1
100%
O Share
1.
Consider the following program which is saved as sum.cpp.
Search tools
#include <iostream>
using namespace std;
#define SIZE 10
Export PDF
void main ()
{
int i, number[SIZE], sum;
Adobe Export PDF
sum = 0;
for (i = 0; i < SIZE; i++) {
Convert PDF Files to Word
or Excel Online
cin >> number[i];
sum += number[i];
Select PDF File
}
cout << "\nThe sum of the numbers is ";
Lab 9.pdf
for (i = 0; i < SIZE; i++) {
if (i != SIZE - 1)
cout << number[i] « " + ";
Convert to
Microsoft Word (*.docx)
else
cout << number[i] <<
":
=
Document Language:
}
cout << sum;
English (U.S.) Change
}|
Modify sum.cpp so that the user input the array elements number[i] from a text file
and prints out the output onto a text file as well. Use the C++ functions/identifiers
provided in the header file <fstream>.
Convert
Create an input file ("numbers.txt") to store any 10 integers. Make sure this file is
saved in the same folder as the sum.cpp file. Use the following data in the input file:
Create PDF
4 7 2 5 6 1 6 5 1 4
Edit PDF
Use the output file name as "output.txt". This file will be created automatically after
the successful running of the above program. The output in this file will be:
The sum of the numbers is 4 + 7 + 2 + 5 + 6 + 1 + 6 + 5 + 1 + 4
= 41
Create, edit and sign PDF
forms & agreements
Start Free Trial
8:47 PM
O Type here to search
a 4») ENG
IMI
U
15/2/2021
Transcribed Image Text:A Lab 9.pdf - Adobe Acrobat Reader DC File Edit View Window Help Home Tools Lab 9.pdf Sign In 1 / 1 100% O Share 1. Consider the following program which is saved as sum.cpp. Search tools #include <iostream> using namespace std; #define SIZE 10 Export PDF void main () { int i, number[SIZE], sum; Adobe Export PDF sum = 0; for (i = 0; i < SIZE; i++) { Convert PDF Files to Word or Excel Online cin >> number[i]; sum += number[i]; Select PDF File } cout << "\nThe sum of the numbers is "; Lab 9.pdf for (i = 0; i < SIZE; i++) { if (i != SIZE - 1) cout << number[i] « " + "; Convert to Microsoft Word (*.docx) else cout << number[i] << ": = Document Language: } cout << sum; English (U.S.) Change }| Modify sum.cpp so that the user input the array elements number[i] from a text file and prints out the output onto a text file as well. Use the C++ functions/identifiers provided in the header file <fstream>. Convert Create an input file ("numbers.txt") to store any 10 integers. Make sure this file is saved in the same folder as the sum.cpp file. Use the following data in the input file: Create PDF 4 7 2 5 6 1 6 5 1 4 Edit PDF Use the output file name as "output.txt". This file will be created automatically after the successful running of the above program. The output in this file will be: The sum of the numbers is 4 + 7 + 2 + 5 + 6 + 1 + 6 + 5 + 1 + 4 = 41 Create, edit and sign PDF forms & agreements Start Free Trial 8:47 PM O Type here to search a 4») ENG IMI U 15/2/2021
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education