COM SCI 31 Study Guide - Midterm Guide: Decimal Mark

247 views1 pages
25 Mar 2017
School
Professor

Document Summary

// declares functions that are used to compute mathematical operations. // min/max limits of integral types (int_max, chars/short/long); for cin. ignore(int_max, (cid:858)\n(cid:859)) // can use asserts to test if functions work as expected magic formula = outputs 2 digits after the decimal point when working with cout. Pass by reference = permanent (use &) cout. setf(ios::fixed); cout. setf(ios::showpoint); cout. precision(2); Different function types with same name and parameters does not work! Default value argument initializing parameters in the beginning for functions void showarea(int length = 1, int width = 1); Arrays can be any of the following: int arr[] = {1,2,3}; int arr[3]; Arrays in functions: int funcname(arr[], 3: parameters = array name only, array size can set a constant variable as a number first to put it in array size (i. e. arr[size])