rendered paste body#include <iostream>
#include <fstream>
#include <string>
using namespace std;
float getpart(ifstream& myfile);
int x = 0;
int y = 0;
const int badinput = -1;
int main()
{
string label;
ifstream myfile;
string filename;
cout << "Your Grade Calculator!" << endl;
cout << "What file has your scores in it?: ";
cin >> filename;
cout << endl;
myfile.open(filename.c_str());
if (!myfile)
cout << "The file could not be opened." << endl;
getline(myfile, label);
myfile >> x;
float runit = getpart(myfile);
float runitagain = getpart(myfile);
myfile.close();
return 0;
}
float getpart(ifstream& myfile)
{
float percentage;
string label;
while(!myfile.eof())
{
while (x != -1)
{
myfile >> y;
cout << x << " " << y << endl;
myfile >> x;
}
}
return percentage; // no use yet
}