COMPTNG 10A Study Guide - Final Guide: Unit Testing, Red Bull, Modular Programming

55 views2 pages
14 Sep 2017
School
Professor

Document Summary

Final: functions function declaration (or forward declaration) example: double max(double a, double b); Inputs (double a, double b) = parameters or arguments calling the function: max(3, c); double max(double a, double b) = function signature/prototype function definition: black box functionsignature { function body. View inputs and outputs, not internal workings. Functions considered as bb: allows separation of concerns (handle 1 issue at a time) E(cid:454)a(cid:373)ple: do(cid:374)"t k(cid:374)o(cid:449) ho(cid:449) s(cid:395)(cid:396)t (cid:449)o(cid:396)ks, a(cid:374)d that"s fi(cid:374)e. It is the p(cid:396)og(cid:396)a(cid:373)"s e(cid:374)t(cid:396)(cid:455) poi(cid:374)t: os calls the main function when you run the program. Ca(cid:374)"t use a fu(cid:374)(cid:272)tio(cid:374) (cid:271)efo(cid:396)e it is de(cid:272)la(cid:396)ed of defi(cid:374)ed. A function definition can be provided in another file without being. #included: but must #include declarations (. h files) . h files = header files = contain declarations by convention. cpp files = cpp/source files = contain definitions by convention. One . cpp file must have one main function (usually main. cpp) . h files more readable than . cpp because declarations more concise than definitions scope.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents