Week 5 Notes COP 3014
Week 5 Notes COP 3014 COP 3014
Popular in Programming I
Popular in Engineering and Tech
This 5 page Class Notes was uploaded by Annette Marin on Friday September 25, 2015. The Class Notes belongs to COP 3014 at Florida State University taught by Melina Vastola in Fall 2015. Since its upload, it has received 72 views. For similar materials see Programming I in Engineering and Tech at Florida State University.
Reviews for Week 5 Notes COP 3014
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/25/15
Functions 92515 321 PM 0 Starting today by learning how to se prebuiltprewritten functions We ll look at the cmath library to start For reference you can look at ccom A function is a reusable portion of a program sometimes called a procedure or subroutine First Like a miniprogram or subprogram in its own right Second Can take in special inputs arguments ThirdCan produce an answer value return value Fourth Similar to the idea of a function in mathematics Within functions there are 2 major points of view First Builder of the function responsible for creating the declaration and the definition of the function ie how it works Second Caller somebody ie some portion of code that uses the function to perform a task include ltcmathgt in main double y 90 double root sqrty cout ltlt sqrtY cout lt lt sqrt250 if sqrty 30 cout ltlt sqrtlOO 2A8 7lt int x 2A8 double x pow28 cout ltlt pow53 125 include ltiostreamgt using namespace std bool InOrderint x int y int 2 function declarations double averageint a int b int c int main int user1 gtgt user2 gtgt user 3 cout ltlt Hey enter three ints and I ll tell you if they re in order 9 cin gtgt user1 gtgt user2 gtgt user3 double 2 cout ltlt average 1 2 3 z average 10 3 6 cout ltlt all donequot return 0 function definitions double averageint a int b int c double avg a b c30 return avg boolInOrder int x int y int 2 ifx lt y ampampy lt 2 return true else return false More on Functions for int i 0 i lt 10 i cannot do cout ltlt i int main put functions here 92515 321 PM 92515 321 PM
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'