All pastes #445019 Raw Edit

AppleBoy

public cpp v1 · immutable
·published 2007-04-17 17:34 UTC
rendered paste body
#include <iostream>#include <iomanip>#include <string>#include <fstream>using namespace std;int main (void){        string names[7];   //holds the name of the 7 walkers        int beginMiles[7];  //Miles they started at        int endMiles[7];    //Miles they ended at        int totalMiles[7];  //Total miles they walked        int walkerCnt;                          //keeps track of what walker we're on        ifstream logFile;  //file holding all the walkers' data        //variable initialization        walkerCnt=0;        logFile.open ("WalkersArray.txt");        while (logFile.is_open() && !logFile.eof())        {                getline(logFile, names[walkerCnt]);                logFile >> beginMiles[walkerCnt];                logFile.ignore(1,' ');                logFile >> endMiles[walkerCnt];                totalMiles[walkerCnt]=endMiles[walkerCnt]-beginMiles[walkerCnt];                walkerCnt++;                cout << "opened";        }        cout << "Member\t\tInitial Mileage\t\tFinal Mileage\t\tMiles Walked\n";        for (int i=0; i <7; i++)        {                cout << names[i] << "\t" << beginMiles[i] << "\t" << endMiles[i] << "\t" <<                                 totalMiles[i] << "\n";        }        return 0;}