Code:
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream in_file;
in_file.open("Summation.dat",ios::in);
int i;
int A[20];
float sumPos;
float sumNeg;
in_file >> i;
while (!in_file.eof())
{
for (i = 0; i < 20; i++)
{
if (i < 0)
sumNeg += A[i];
else sumPos += A[i];
}
in_file >> i;
}
cout << "Sum of Positive Integers = " << sumPos << endl;
cout << "Sum of Negative integers = " << sumNeg << endl;
in_file.close();
return 0;
}