I had my code working properly, but once I added my last array, it goes through the compile and then errors out....and I'm not quite sure why....
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
double num[100], sum, count, newnum[100];
int j,i;
ifstream Input;
Input.open("InputNumbers.txt");
if (Input.fail())
{
cout << "Can't Open Input File!" << endl;
exit(1);
}
count =0;
sum=0;
while (!Input.eof())
{
for (j=0;j<=7;j++)
{
Input >> num[j];
cout << num[j] << " ";
count++;
sum+=num[j];
}
}
cout << endl;
cout << num[0] << " " << num[1] << " " << num[2] << " ";
cout << endl;
cout << "Count = " << count << endl;
cout << "Sum = " << sum << endl;
double average = sum / count;
cout << "Average = " << average << endl;
j=0;
for(i=0;i<=(j+1);i++)
{
newnum[i]= pow((num[j]-average),2);
j++;
}
return 0;
}