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

how to write this program? a) A program that asks the user to enter five numbers

ID: 3620404 • Letter: H

Question

how to write this program?
a)  A program that asks the user to enter five numbers. Use a floating point data type to hold the numbers.The program should create a file and save all five numbers to the file.
b) Another program that opens the file created by program a, reads the five numbers, and display them. The program sholud also calculate and display the sum of the five numbers.
Is that any other simple way to write these programs? Other then the one you guys answered. I'm still having trouble to compile it.
Thanks how to write this program?
a)  A program that asks the user to enter five numbers. Use a floating point data type to hold the numbers.The program should create a file and save all five numbers to the file.
b) Another program that opens the file created by program a, reads the five numbers, and display them. The program sholud also calculate and display the sum of the five numbers. Is that any other simple way to write these programs? Other then the one you guys answered. I'm still having trouble to compile it. Thanks

Explanation / Answer

please rate - thanks part 1 #include <iostream>
#include <fstream>
using namespace std;
int main()
{ofstream out;
double num;
int i;
out.open("data.txt");
cout<<"Enter 5 numbers: ";
for(i=1;i<=5;i++)
   {cout<<"enter number "<<i<<": ";
   cin>>num;
   out<<num<<endl;
   }
out.close();
system("pause");
return 0;
}





------------------------------------- part 2