ENGR 101 Final: ENG101 - C++ Review

3 Pages

Course Code
ENGR 101
Rick Niciejewski

This preview shows page 1. Sign up to view the full 3 pages of the document.
C++ Review Bool - 0=false, 1 / any value=true LIBRARIES cmath Standard math library cstdlib C standard library (common functions, ex. rand) iostream Standard input/output (cin and cout) fstream File input/output through streams iomanip Set precision for printing floating point numbers string The string datatype vector The vector datatype ORDER OF PRECEDENCE 1. Not / sign change (! -) 2. Multiplication / Division (* /) 3. Addition / Subtraction (+ -) 4. Insertion extraction (<< >>) 5. Less / Greater Than (< > <= >=) 6. Equal / Not Equal (== !=) 7. And (&&) 8. Or (||) 9. Assignment (=) INPUT / OUTPUT ifstream fin; ifstream fin(“data.txt”); fin.open(“data.txt”); or ifstream fin(string.c_str()); fin.close(); //Always close at end fin.close(); fin.fail() - returns true if fin does not open fin.is_open() - returns true if fin opens getline(fin, string) - stores the entire line from fin into string while(fin >> variable) - reads in data from fin when there is an unknown amount ofstream fout(“file.txt”); fout.close(); SELECTION if() else if() else() LOOPS for(int i=0; i> xpoint >> ypoint) for(int i=0; i>=0; i--) while(getline(fin, name)) while(word.find(“fun”) != word.npos) FUNCTIONS int function(parameters) { // Do stuff } function(const vector &numbers) - pass by const reference, used for large data types (doesn’t copy all that data) and won’t change original values Pass by value - default, does not change value of variable outside of function Pass by reference - & changes in function are v
More Less
Unlock Document

Only page 1 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.