All pastes #253728 Raw Edit

sFc| 2

public text v1 · immutable
#253728 ·published 2006-11-21 01:21 UTC
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
}