assignment operator... i think

This is a discussion on assignment operator... i think within the C++ Programming forums, part of the General Programming Boards category; Hi I have come accross this in my programming book... Code: += This is probably very easy but i have ...

  1. #1
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321

    assignment operator... i think

    Hi
    I have come accross this in my programming book...

    Code:
    +=
    This is probably very easy but i have no idea what it is.

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    It takes the value you have and adds something to it.
    Its the same as doing:
    int a = 10;
    a= a+ 4;

  3. #3
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    Thanks

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    835
    There's a good chance that the index of your book lists these symbols before "A".

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Basically, C++ has quite a few "composite assignment" operators of the form op=, where op is any of [+, -, *, /, &#37;, &, |, ~, <<, >>] and perhaps more that I forgot. They all are defined such that
    expr1 op= expr2
    is equivalent to
    expr1 = expr1 op expr2
    except that expr1 is evaluated only once.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu
    By Krush in forum C Programming
    Replies: 17
    Last Post: 09-01-2009, 03:34 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 07:22 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. Help with a pretty big C++ assignment
    By wakestudent988 in forum C++ Programming
    Replies: 1
    Last Post: 10-30-2006, 09:46 PM
  5. Replies: 1
    Last Post: 10-27-2006, 02:21 PM

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