# my final questions i am new to c++

This is a discussion on my final questions i am new to c++ within the C++ Programming forums, part of the General Programming Boards category; 1. printf("%d", 10*5/10); what is this result? 2. printf("%d", 10+5-5); what is this result? 3. a=d++ +(b=a); a=4,b=4,d=4 a=? 4. ...

1. ## my final questions i am new to c++

1. printf("%d", 10*5/10); what is this result?

2. printf("%d", 10+5-5); what is this result?

3. a=d++ +(b=a); a=4,b=4,d=4 a=?

4. c=a+ a++ - b--; a=4,b=4 c=?

5. c=a+ ++a - b--; a=4,b=5 c=?

6. if(a==0 && b==0) printf("1);
else
if(a==0 && b==0) printf("2");
else printf("3");

(if a=1 and b=0) what is the result?
(if a=0 and b=0) what is the result?
(if a=0 and b=1) what is the result?

2. 1. printf("&#37;d", 10*5/10); what is this result?
Zero

2. printf("%d", 10+5-5); what is this result?
Also Zero

3. a=d++ +(b=a); a=4,b=4,d=4 a=?
If you've got a compiler, try it.

4. c=a+ a++ - b--; a=4,b=4 c=?
5. c=a+ ++a - b--; a=4,b=5 c=?
Side_effect: (++x + y*x + y*x) != (y*x + ++x + y*x) ?

6. dunno, bored of doing your homework.

3. Also Zero
O_o

Okay...

Ignore operator precedence, ignore operator associativity, ignore the fact that we are apparently discussing C or C++, how in the world are you getting zero for that?

Soma

4. I was thinking the same thing...
I was also thinking why printf is used when it's C++...

5. > how in the world are you getting zero for that?
Because I couldn't give a rats ass whether the cross-forum spammer, who is too lazy to even fire up the compiler and actually punch out 5 lines of code to get the answer, either learns to think for themselves, or performs a drone-like copy of whatever is posted and subsequently fails.

I could have written
Also zero
but that might have tipped them off.

So long as someone doesn't blurt out 42 (or the other right answer), then all will be well I suppose.

7. Originally Posted by svetlana6167
if this is for a class, that is usually the first thing they teach you.

if not. Please let us know what platform for which you are trying to write this code (windows/unix/linux/mac/etc.) and what set of development tools you are using (msvc, gcc, sun, intel, etc) and we will try to help you out.

8. Oh... my... goodness...
The first thing to do when learning C/C++ is to get a compiler and editor/IDE.
Don't expect to write code without compiling it.

And even though you were told, you continue posting on both forums. That is why they call you a cross-forum spammer.

Well that should have been your first question then!.

As Elkvis says, if you want useful help, provide details.

10. Originally Posted by Elysia
Oh... my... goodness...
The first thing to do when learning C/C++ is to get a compiler and editor/IDE.
Don't expect to write code without compiling it.
Don't presume that the way you were taught is the way that everyone is taught. Especially when you consider from what country someone named "Svetlana" whose first language clearly isn't English might be.

11. Originally Posted by Angus
Don't presume that the way you were taught is the way that everyone is taught. Especially when you consider from what country someone named "Svetlana" whose first language clearly isn't English might be.
I've heard of theory-intensive computer science classes where you think about what the computer might do, but that's frankly ridiculous for an intro to programming course.

12. Not ridiculous, but it is beyond "very disciplined". The way they run their universities in the FSU makes it seem like they were setup by captured SS officers. I'll never forget my Russian complex variables prof. What a Nazi!

13. Originally Posted by Angus
Don't presume that the way you were taught is the way that everyone is taught. Especially when you consider from what country someone named "Svetlana" whose first language clearly isn't English might be.
If taught already, then shame on the one.
If not taught already, then one should heed the advice and get a compiler and IDE/editor to compile and test all subsequent code.