I'm a little lost here. I'm trying to read from a file named source.txt located in the same area as my program. If i could figure this out i could continue with the rest of the program. I'm just getting a blank screen so i know i'm way off heres the code if anyone could push me in the right direction it would help greatly thanks
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <fstream>
#include <istream>
using namespace std;
float readStoreCount(float numbers[]);
float printNumbers(float numbers[]);
int main ()
{
float numbers[100];
numbers [100] = readStoreCount(numbers);
printNumbers(numbers);
system ("pause");
return 0;
} //main
float readStoreCount(float numbers[])
{
int i = 0;
ifstream source;
source.open ("source.txt");
if (!source)
{ cerr << "\aError 100 opening source.txt" << endl;
exit (100);//opening failure test
}
for (i = 0; i < 100; i++)
cin >> numbers [i];
cout << "numbers are going in" << endl;
source.close ();
if (source.fail())
{ cerr << "\aERROR 102 closing source.txt" << endl;
exit (102);//closing failure test
}
}
float printNumbers(float numbers[])
{
int i;
float numbersIn[100];
for (i = 100; i > numbers [i]; i--)
cout << numbers [i];
}