CP104 Lecture Notes - Lecture 10: Code Reuse

25 views3 pages
School
Course
Professor
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

Document Summary

A function is a group of statements that exist within a program for the purpose of performing a specific task. Easier facilitation of teamwork each member works on a different function. Function should be in a separate file from main program. Indentation in controls structure must have same amount of space. These are var i(cid:374) a fu(cid:374)(cid:272)tio(cid:374) he(cid:374)(cid:272)e lo(cid:272)al a(cid:374)d (cid:272)a(cid:374)"t (cid:271)e used (cid:271)y (cid:373)ai(cid:374) progra(cid:373). Can have same name in different functions as they are local var so in essence they are different var with same name. Where var can be seen ex inside function, outside function etc. Constants: defined in 1 place and used in func. Preconditions: what must be true about parameters for func to work. X1 x coordinate of 1st point on graph(float) [condition can be like (int != 0)] X2 x coordinate of 1st point on graph(float) y1 y coordinate of 2nd point on graph(float) y1 y coordinate of 2nd point on graph(float)

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
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents