functions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • osha
    New Member
    • May 2010
    • 1

    functions

    If a function needs to modify more than one variable, it must:
    Choose one answer.
    a. be a call by reference function.
    b. be pass by value.
    c. return all values needed.
    d. be a void function.
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    It is not appropriate for us to simply hand you the answer. What do you think about these choices?

    Comment

    • whodgson
      Contributor
      • Jan 2007
      • 542

      #3
      What do you make of this function:
      Code:
      void computeCircle(double& area, double& circumference,double r)
      {
      area = PI*r*r;
      circumference = 2*PI*r;
      }
      /*Output
      Enter radius ( 0 to quit)21.3
      Area : 1425.31  circumference : 133.832
      */

      Comment

      • jkmyoung
        Recognized Expert Top Contributor
        • Mar 2006
        • 2057

        #4
        See whodgson's post, and don't take my answer too seriously.

        I would say "none of the above."
        The question is not specific enough and is poorly written.
        Code:
        void changeLocalVariablesForNoReason(){
        int i = 0; 
        int j = 0;
          i = 1;
          j = 2; //oh, it changed!
        }

        Comment

        Working...