COM SCI 31 Lecture Notes - Lecture 9: Local Variable, Ebcdic, Infinite Loop

29 views8 pages
22 Oct 2016
School

Document Summary

<< endl; bool isvalidphonenumber(string pn) // phone number is copied into local variable pn for the specific function. whatever happens has no effect on the original. // a valid phone number string contains exactly 10 digit characters int numberofdigits = 0; for (int k = 0; k != pn. size(); k++) numberofdigits++; return (numberofdigits == 10); string digitsof(string pn) Normaly, arguments to a fcn are copied into the corresponding parameters. Alternatively, arguments can be passed by reference : parameter is just another name for the argument, not a copy of it polartocartesian(double rho, double theta, double xx, double yy); // not right can"t write a fcn that returns more than one value need 2 doubles - use them as last two parameters. #include // gives u access to cos and sin fcns int main() double r; double angle; The rest of this iteration equivalent form: (one less level of nesting) for ( ; . if ( )

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