rec10 - ofile.open(fileName.c_str()) } } void...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 #include <iostream> #include <fstream> #include <string> using namespace std int main() { ofstream ofile double avg, first, second, third, fourth string name openOutFile(ofile) getData(name, avg) minimum(first, second, third, fourth) getAvg(first, second, third, fourth, min) } { string fileName cout << "Enter your filename\n" cin >> fileName ofile.open(fileName.c_str()) while (ofile.fail()) { cout << "Please try again\n" ofile.clear() cin >> fileName
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: ofile.open(fileName.c_str()) } } void getData(string&, double&) { string name double first, second, third, fourth, min, avg cout << "enter name" << endl cin >> name cout <<"enter grades" << endl cin >> first >> second >> third >> fourth min = minimum(first, second, third, fourth) Sheet1 Page 2 avg = getAvg(first, second, third, fourth, min) } double minimum(double&, double&, double&, double&) { double first, second, third, fourth, min d min=first if (min > second) { min=second } else if (min > third) { min = third } else (min > fourth) { min = fourth } return min } double getAvg(double&, double&, double&, double&, double&) { double avg, first, second, third, fourth, min avg = ((first + second + third + fourth) - min)/4 return avg }...
View Full Document

This note was uploaded on 04/08/2008 for the course CS 1114 taught by Professor Gallagher during the Spring '08 term at NYU Poly.

Page1 / 2

rec10 - ofile.open(fileName.c_str()) } } void...

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