469,306 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

+= plus equal sign

5
What does += mean?
Expand|Select|Wrap|Line Numbers
  1. int julian_day( int month, int day, int year )
  2. {
  3.   int jday = 0;
  4.   for (int m=1; m<month; ++m )
  5.     { 
  6.       jday += DaysInMonth[m];
  7.       if ( m == 2 && is_leap_year(year))
  8.           ++jday;  // February 29th
  9.     }
  10.   jday += day;
  11.   return jday;
  12. }
  13.  
Thanks a lot
Jul 28 '07 #1
2 64650
JosAH
11,448 Expert 8TB
+= is the 'add assignment operator; e.g.

Expand|Select|Wrap|Line Numbers
  1. int foo= 1;
  2.  
  3. foo+= 41; // foo has value 42 now
  4.  
You can do the same with most of the other binary operators; && and || can't
be used like that.

kind regards,

Jos
Jul 28 '07 #2
eg a+=1 means a=a+1 such an operation can be used for all arithmetic operations
Jul 28 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by johndesp | last post: by
11 posts views Thread by =?ISO-8859-1?Q?Konrad_M=FChler?= | last post: by
5 posts views Thread by souporpower | last post: by
1 post views Thread by =?Utf-8?B?Sm9zdWZm?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.