IDEA: Addition function

This is a discussion on IDEA: Addition function within the Contests Board forums, part of the Community Boards category; The task is to make a function that adds two numbers. Int, short, char? You decide! Sounds simple, huh? Well, ...

  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, 12: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, 01:46 PM
  5. Replies: 4
    Last Post: 11-23-2003, 06:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21