The problem so far is how to get the second row of data out of the file and put it in an array.
For example if my file look like this:
1. 20
2. 15
3. 77
4. 15
5. 29
6. 77
How would I get the 20, 15, etc. into an array without reading the 1. , 2. , 3. ?
I have more questions but I need to figure this out first before I get into that. Thanks in advance!!!
Here's my code so far:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main (int argc, char * const argv[]) {
std::cout << "Hello, World!\n";
double time_to_accesstrack, sort_coeficient;
string input_filename;
cout << "Welcome to the I/O reordering analyzer" << endl;
cout << "\n"<< endl;
cout << "How long in milleseconds does the drive need to access a track?";
cin >> time_to_accesstrack;
cout << "What is the CPU's sort coefficient (in milliseconds)?";
cin >> sort_coeficient;
cout << "What is the name of the test data file?";
cin >> input_filename;
cout << "\n" << endl;
cout << "Analyzing..."<< endl;
while (true)
{
string infilename;
getline( cin, input_filename );
infile.open( input_filename.c_str() );
if(!inFile) {
cout << endl << "Failed to open file " << input_filename;
return 1;
}
long n = 0;
while(!inFile.eof()) {
inFile >> n;
cout << std::setw(15) << n;
}
cout << endl;
return 0;
}
}

New Topic/Question
Reply



MultiQuote







|