Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: li_umr; Bo qirlpa(n ep Bo ssme) The function should return t u of the squirrels are playing, otherwise it should return f l e re as. Exercise 5 We are having a party with amounts of tea and candy. Write a function named t a p r y hat has two parameters: e _ a t t ittapryitta itcny; n e_at(n e, n ad) This function returns the outcome of the party encoded as an integer: 0 means bad, 1 means good, and 2 means great. A party is good (1) if both t a nd c n y re at least 5. However, if either t a r e a a d a e o c n y s at least double the amount of the other one, the party is great (2). However, in all cases, if a d i either t a r c n y s less than 5, the party is always bad (0). e o a d i Exercise 6 Write a function named l n _ u that has three integer parameters: oesm itln_u(n a itb itc; n oesmit , n , n ) This function returns the sum of parameters a b nd c However, if one of the parameters is equal to , a . one or both of the other parameters, then the equal values are treated as 0 when the sum is calculated. For example: ● l n _ u ( , 2 3 returns 2 (the two 3's are treated as 0); oesm3 , ) ● l n _ u ( , 3 3 returns 0 (the three 3's are treated as 0). oesm3 , ) Exercise 7 Write a function named c o e f r hat has three integer parameters: l s _ a t _olcoefrita itb itc; Bo ls_a(n , n , n ) This function returns t u if one of b r c s "close" to a differing from a y at most 1) and the other re o i ( b is "far" from a differing from a nd the "close" parameter by 2 or more). ( a Note: the C standard library has a function that r...
View Full Document

This lab report was uploaded on 03/28/2014 for the course SYSC 2006 taught by Professor Schram during the Spring '12 term at Carleton CA.

Ask a homework question - tutors are online