Alright I'll just throw this here in case anyone knows.
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
float total, median, mean, line;
unsigned int linecount;
ifstream inFile;
string infilename = argv[1];
string outfilename = argv[2];
inFile.open(infilename);
float sortnum[100];
if (inFile.fail())
{
cout << "\nThe file was not successfully opened." << endl;
return EXIT_FAILURE;
}
linecount = 0;
while (!inFile.eof()) //reads file into the array
{
getline(inFile, line);
if(line.empty()) continue;
sortnum[linecount] = line;
linecount += 1;
}
return 0;
}
This isn't the entire program(hence the variables that are declared and not used), just the part where I'm inputting the numbers from the file into an array. Basically it's supposed to read exactly 100 value from a file where there's one value on each line, and put it into an array. Later I have to sort the numbers to put them in order and output them into another file, but that isn't the part I'm having trouble with.
The compiler gives me multiple ridiculous errors with the line "getline(inFile, line);" It says it doesn't recognize "getline, but I thought that was included under <string>.
Also, it has an error for "line.empty()", which should be included under <string> as well, right?
This is what the compiler says:
I could really use some help with this. Please Please Please.