Input text sorting HELP

Hi-

I have to put this table of numbers from .txt doc:
Phase#/Task#/Time

1 100 2
1 101 5
2 102 3
3 103 2
3 104 8
3 105 1
4 106 1
4 107 4

and sort/display them in a table with columns
so it tells the phase #, the number of tasks in that phase, and the longest time for the task in that phase.

Should look like:

Phase/Tasks/Time
1 2 5
2 1 3
3 3 8
4 2 4

So far I have:


#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int main() {

int currentPhase=0, workingPhase, taskid=0, steps=0, days, maxDays=0, accumulator=0;
string fileName;


cout << "Please enter your filename.txt. "<<endl;
cin>>fileName;

ifstream myfile;
myfile.open(fileName.c_str());


while (myfile>>workingPhase)
{
myfile>>taskid;
myfile>>days;

// this is the part im stuck on..
// I dont how to separate it from the different phases.

while (workingPhase>currentPhase){
++currentPhase;
cout << workingPhase<<
}

return 0;
}



Can someone PLEASE help? Due tonight!!
Thanks!!
Topic archived. No new replies allowed.