Thread: Homework guidence, very important

  1. #1
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331

    Homework guidence, very important

    Ok heres the deal, i had inschool suspension so i can't ask her this question as next time i c her its due. I know how to do everything it asks, but the way its asked i dunno if its one program or two or what, can someone help me get what it is she wants, here is the question to exacts:

    Write function with 2 ref parameters to multipy with int and double in complete program-asking user for two values-prompt user,send values to function - add 2 to each and output in main - make sure u match types when passing.

    Now i know all that, what i don't get is am i multiplying or adding two??!!

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    That's one hell of a poorly worded question Personally I think the author needs a lesson in how to write proper assignments

    Anyways, here's my guess (and that's all it is):

    - Write a function that has two parameters, using pass by reference.
    [<--SNIP-->]
    Nah, I give up. If you're simply adding 2 to each of the numbers, that's too easy, but if you multiply them together where does the result go? Is it passed back in the return from the function? The requirements are so unclear... sorry I haven't been any help at all
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    well heres what it is if i multiply: Hope it helps to see where shes going.

    Code:
    int multiply(int &val1, double &val2);
    
    int main()
    {
    int value;
    double value2;
    
    cout<<"Enter integer: ";
    cin>>value;
    
    cout<<"Enter double: ";
    cin>>value2;
    
    cout<<multiply(value,value2);
    
    return 0;
    }
    
    
    int multiply(int &val1, double &val2)
    {
    double newval;
    
    newval = val1 * val2;
    
    return newval;
    }
    Last edited by RoD; 12-04-2002 at 07:24 PM.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Are you sure about using int as the return type ? I mean, what is newval anyway?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    its jus a throw together :P

    Fark it i'll jus ask her its her fault anyway lol.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Homework
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-03-2001, 04:39 PM
  2. Homework
    By kermi3 in forum C++ Programming
    Replies: 15
    Last Post: 09-26-2001, 03:16 PM
  3. Homework
    By kermi3 in forum Windows Programming
    Replies: 5
    Last Post: 09-15-2001, 11:48 AM
  4. Homework
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 09-10-2001, 01:26 PM