... just like “*” is an operator that represents multiplication.
It represents multiplication and pointer dereference.
It works on two or more operands and produces an output. For example 1+2+3, here the “+” operator works on three operands and produces 6 as output.
No; + works on one (for unary plus, e.g., +1) or two operands only. If you write 1+2+3, that's really (1+2)+3: the first + take the operands 1 and 2, adds them, and stores the result in a temporary, say T0; the second + takes the operands T0 and 3 and adds those. Speaking of (), you don't mention anything about operator precedence, associativity, or how () can be used to change the default.
You left out pointer, array, and bit-wise operators in your list. You're also missing several assignment operators, e.g., <<=. You also don't mention the difference between pre- and post-increment and decrement.
There's no such thing as a "nested if statement". It's just ifstatement [elsestatement]. If either of those statements just so happen to be another if, so be it. You also don't mention the common problem that else binds to the most recent if, nor how to solve that problem.
I realize you're trying to present a simple introduction, but, well, 5-year-olds are just too young a target audience. Also, if you're going to omit things for simplicity, you should at least mention them in passing, then say "more on X later."
There are innumerable "Intro to C++" sites out there. It's not clear what unique perspective yours brings to the table.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It represents multiplication and pointer dereference.
No;
+
works on one (for unary plus, e.g.,+1
) or two operands only. If you write1+2+3
, that's really(1+2)+3
: the first+
take the operands1
and2
, adds them, and stores the result in a temporary, sayT0
; the second+
takes the operandsT0
and3
and adds those. Speaking of()
, you don't mention anything about operator precedence, associativity, or how()
can be used to change the default.You left out pointer, array, and bit-wise operators in your list. You're also missing several assignment operators, e.g.,
<<=
. You also don't mention the difference between pre- and post-increment and decrement.There's no such thing as a "nested
if
statement". It's justif
statement [else
statement]. If either of those statements just so happen to be anotherif
, so be it. You also don't mention the common problem thatelse
binds to the most recentif
, nor how to solve that problem.I realize you're trying to present a simple introduction, but, well, 5-year-olds are just too young a target audience. Also, if you're going to omit things for simplicity, you should at least mention them in passing, then say "more on X later."
There are innumerable "Intro to C++" sites out there. It's not clear what unique perspective yours brings to the table.