1.

Solve : [C++] In the statement -- -- What does i++ mean??

Answer»

-- The statement is
for ( int i = 2; i < 30; i++ )
{
--
Based on my assumption, i++ means i+1... but -- I don't code in C++ at all.
i++ mean post increment. equivalent to i=i+1

edit: it means "use the value of i first, then increment"Quote from: gh0std0g74 on April 24, 2009, 10:05:27 PM

i++ mean post increment. equivalent to i=i+1
Like in batch,

set /a num+=1Quote from: Helpmeh on April 25, 2009, 10:25:19 AM
Like in batch,

set /a num+=1

C++ is NOT like batch at all.Quote from: Geek-9pm on April 25, 2009, 06:23:26 PM
C++ is NOT like batch at all.

I THINK he meant to say that set /a num+=1 is the batch equivalent to the C++ command, does same type of thing. Quote from: x2543 on April 25, 2009, 06:40:59 PM

I think he meant to say that set /a num+=1 is the batch equivalent to the C++ command, does same type of thing.

OK, I see what you mean. On my computer
set /a num=+1
gives the value as 1
Maybe he meant
set /a num=num+1
Or did I miss something? What did I miss?
Quote from: Geek-9pm on April 25, 2009, 06:51:39 PM
OK, I see what you mean. On my computer
set /a num=+1
gives the value as 1
Maybe he meant
set /a num=num+1
Or did I miss something? What did I miss?

set /a num+=1 and
set /a num=%num%+1
are the same thing. It will return 1 because a blank variable is equaled to 0, but also a blank line. In math, it's equaled to 0, but with ECHO it counts as nothing being there.i++;

simply mean
i=i+1;
i++; will just increament value of i by 1.

in c,or c++
i++,++i are same if. if they are not used with other variable.
in the same way --i,i-- are same.

consider
i=5;
i++;

now the value of i is simply 6;
i=5
++i;
again value of i is 6;

but u just consider statement
i=5;
c=i++;
the value of c is 5, i is 6.
i=5;
c=++i;
the value of c is 6,i is 6;++ is an unary increment operator which INCREMENTS the value of the operand by 1. I'd recommend reading books about C++. Quote
books about C++.
So if I go to the library and ASK for a BOOK about C++
they will give me a book about D
Which comes after C.
Is that right? Quote from: Geek-9pm on April 28, 2009, 10:16:02 AM
So if I go to the library and ask for a book about C++
they will give me a book about D
Which comes after C.
Is that right?

very funny Never knew your librarian uses a C++ compiler for everything that is told. Anyways you should get "Expression syntax" because "give" or "me" or "a" or "book" or "about" or "C++" none are valid in C++ syntax. Try
Code: [Select]library.getBook("C++ for dummies");
If that fails refer to the manual for that librarian.


Discussion

No Comment Found