Hi This is how my input file looks like and i while loop is sorta messed up, i'm a newbie, can someone give me a lil help?
Input file:
Iron Man 90 80 70 -1
Captain American 90 80 70 60 -1
Spider Man -90
Phil O'Sophy 72 81 63 -40
I need to list them out one by one and find their averages, so far this is what i have:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream in;
char Data = char();
char Ender = char();
string First = string();
string Last = string();
int Grade = int();
string Test = string();
in.open("C:\\Input.txt");
if(!in)
{
cout << "Error: Input File Cannot Be Oppened" << endl;
}
in >> Data;
while (!in.eof())
{
in >> First >> Last >> Grade;
while ( Ender != '-' )
{
cout << First << Last << Grade;
}
}
in.close();
cout << "End-of-file reached.." << endl;
cin >> Test;
}