Functions that return two values

Discussion in 'C++' started by psppb, Jan 22, 2008.

  1. psppb

    psppb New Member

    Joined:
    Dec 26, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Hello all. I have a function that is trying to return an array (overcoat) and a variable 'money' The program is quite large and is and old computer game called "Dopewars" Someone wrote it for the old graphing calculators back when I was in High School.

    in the program Money is a global variable and so is overcoat because they change everyday. the '&' ampersand just does not seem to do the trick. am I overloading it incorrectly?

    here's the code. The jist is that you have thirty days to make as much cash as possible in the "Street Pharmacy" business.

    once again I apologize if this offends anyone but it was a silly game and I am just trying to see if my skills have come along well enough to write it on my own.
    View attachment 4




    the errors are

    68 C:\Documents and Settings\Bill\My Documents\dopewarsrevised.cpp expected primary-expression before "int"
     
  2. psppb

    psppb New Member

    Joined:
    Dec 26, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Update. I cleaned the code up to eliminate the problem of two returns but I still have the most nagging of problems that I cannot seem to figure out. The array is a double

    here is the program... Please help

    Thanks View attachment 5
     
  3. kslpeter87

    kslpeter87 New Member

    Joined:
    Jul 20, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.friendster.com/atlantiz8
    1. your 'drugbuy' function expect to receive an array. But the argument you send from the main is an array subscript notation, which is a content of the array.

    i can run it when i solve this prob.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice