Presentation is loading. Please wait.

Presentation is loading. Please wait.

Opening Input/Output Files void openFiles ( ifstream& infile, ofstream& outfile) { char inFileName[40]; char outFileName[40]; cout<<"Enter the input file.

Similar presentations


Presentation on theme: "Opening Input/Output Files void openFiles ( ifstream& infile, ofstream& outfile) { char inFileName[40]; char outFileName[40]; cout<<"Enter the input file."— Presentation transcript:

1 Opening Input/Output Files void openFiles ( ifstream& infile, ofstream& outfile) { char inFileName[40]; char outFileName[40]; cout<<"Enter the input file name: "; cin>>inFileName; infile.open(inFileName); //open input file cout<<"Enter the output file name: "; cin>> outFileName; outfile.open(outFileName);//open out putfile }

2 #ifndef n To avoid including your.h files more than once, when using multiple files (gives you a redefinition link error), add the following to all you.h files #ifndef FILE_H #define FILE_H //code goes here #endif

3 Three important characteristics of OOP n 1. Encapsulation - see Section 2.1 n 2. Inheritance - hierarchy in which descendant class inherits data and operations from ancestor class n Example: ottoman End table furniture chable chairtable dinette

4 Three important characteristics of OOP n 3. Polymorphism - several operations with same name – binding time - time name/symbol bound to code/value – static binding - resolved at compiled time – dynamic binding - resolved at run time – operation overloading - static binding

5 Specifying Functions n Up to now Purpose/Receives/Returns n Text Book uses Pre- and Post-conditions n Pre-condition: describes what must be true about the state for the function to work correctly n Post-condition: describes what will be true about the state if the pre-conditions are met

6 Specifying Functions cont. n Precondition – discusses appropriate values for receives parameters and member data of object if it is a member function we are specifying n Post-condition – describes what the return variables values will be and what changes will be made to the object

7 Error Conditions Describe what preconditions will be checked by the function (might use try/catch)


Download ppt "Opening Input/Output Files void openFiles ( ifstream& infile, ofstream& outfile) { char inFileName[40]; char outFileName[40]; cout<<"Enter the input file."

Similar presentations


Ads by Google