Thread: IDEA: Addition function

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    IDEA: Addition function

    The task is to make a function that adds two numbers.
    Int, short, char? You decide!

    Sounds simple, huh? Well, here's the catch. You are not allowed to use any mathematical operator, like +,-,* or /, nor use any libraries (except for printing functions, like cout and printf).
    However, you are allowed to use binary operators, like &, | or ^ (is that xor?), and the assignment operator (=).
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Hmmm...
    I didn't look at all other earlier ideas....
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  3. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. Replies: 4
    Last Post: 11-23-2003, 07:15 AM