Computer Hope
Software => Computer programming => Topic started by: liambiscuit on April 24, 2009, 08:42:53 PM
-
-- 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"
-
i++ mean post increment. equivalent to i=i+1
Like in batch,
set /a num+=1
-
Like in batch,
set /a num+=1
C++ is NOT like batch at all.
-
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.
-
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?
-
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++. :)
-
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? ::)
-
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 :P
-
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
library.getBook("C++ for dummies");
If that fails refer to the manual for that librarian.