Application

Application - for (short i = 0; i < fList.GetNumItems();...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include "Application.h" #include <iostream> #include <fstream> #include <math.h> #include <iomanip> void CApplication::Run () { ReadFile(); PrintFile(); } void CApplication::ReadFile() { ifstream inFile ("in.dat"); if (inFile.fail()) { cerr << "File not found." << endl; } string name; while (getline(inFile, name) != NULL) { float GPA; inFile >> GPA; long income; inFile >> income; short test; inFile >> test; inFile.ignore(); short credits = 0; if (GPA > 3.5) ++credits; if (income < 10000) ++credits; if (test > 70) ++credits; CDataType data(name, GPA, income, test, credits); fList.AddOrderedListItem(data); } } void CApplication::PrintFile() { ofstream outFile ("out.dat");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for (short i = 0; i < fList.GetNumItems(); ++i) { CDataType data; data = fList.GetOrderedListItem(i); outFile.setf(ios::left, ios::adjustfield); outFile << setw(20) << data.GetName(); if (data.GetCredits() >= 2) outFile << "\tyes" << endl; else outFile << "\tno" << endl; } outFile << endl << "Sorted list of succesful candidates:" << endl; for (short j = 3; j >= 2; --j) { for (short i = 0; i < fList.GetNumItems(); ++i) { CDataType data; data = fList.GetOrderedListItem(i); if (data.GetCredits() == j) outFile << data.GetName() << endl; } } }...
View Full Document

This note was uploaded on 01/17/2012 for the course CSC 1254 taught by Professor Blanks,l during the Fall '08 term at LSU.

Page1 / 2

Application - for (short i = 0; i < fList.GetNumItems();...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online