Thread: arg...function calls

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    15

    arg...function calls

    im having problems with my function calls and relevant operators...ive been working on this for hours but i cant get the result of my function to be recognized by the main function. this is where im at:
    Code:
    int remainder;
    int multiple (int x, int y)
    {
         
            remainder = x % y;
    
    return remainder;
    }
    
    int choice;
    
    int main ()
    {
    int x;
    int y;
    do{   
        
        cout << "Enter first integer (small): ";
        cin >> y;
        cout << "Enter second integer (larger): ";
        cin >> x;
        cout << "Is the first a multiple of the second?\n";
        if (remainder > 0)
            cout << "No." << multiple (x,y) << "\n";
        else
            cout << "Yes." << multiple (x,y) << "\n";
        
        cout << "Press 1 to try again, any other key to quit: ";
        cin >> choice;
    } while (choice == 1);
    
    return 0;
    }
    it just tells me yes everytime with a zero or one at the end(and i dunno how to remove that either!), so everything else works, even the do-while statement

    any small hints or nudgings in the right direction will help, thank you.
    Last edited by Salem; 09-23-2004 at 02:43 PM. Reason: tag! - you're it - does no-one read the READ BEFORE POSTING post?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. Replies: 12
    Last Post: 10-16-2008, 02:49 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM