hey guys just joined the forum and so far it looks very promising :D
got a quick question for everyone that can help, i am trying to organize a txt file to output the "gpa" from highest to lowest. Now this is what i have so far...
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
string line;
char gpa;
ifstream infile;
infile.open("C:\\progpa.txt");
while(! infile.eof())
{
getline(infile, line);
cout<<line<<endl;
}
system("pause");
return 0;
}
inside the txt file is simply one line: james 3.5
there will eventually be 15 gpa's and names in this file.
I would like to organize it so it display's the name and GPA's from highest to lowest.
I dont know much and would take any help/tips you guys can give. I imagine we have to put a counter/loop inside the file so it can differentiate between the name's and gpa?
Thanks guys