I see, both take effect immediately but the value of the expressions are different?
That explains it. ;-)
Type: Posts; User: Rahiiyja
I see, both take effect immediately but the value of the expressions are different?
That explains it. ;-)
Thanks for your fast reply.
Can I ask you, if '++number' makes the change to number instantly, when does the post-increment ++ take effect?
Take a look at this code:
int number = 9;
if ( number++ == 10)
cout << ”True” ;
else
cout << ”False";
Nevermind the bad formatting, does this code result in "true" or "false"?
To me,...
I have found it very helpful when learning C++. But as laserlight mentions I am still wet behind the ears, and Prata's book is the only one about C++ that I've read so I have nothing to compare it...
Thanks, that's something I should have tried, it solved most of it. The final problem I had was that the strings weren't declared globally, and therefore couldn't be used within the other functions,...
Here's an update of the situation, and some code I've written.
#include <iostream>
using namespace std;
int biggerThan(int, int);
int smallerThan (int, int);
int equal (int, int);
C++ Primer Plus (Fifth Edition), by Stephen Prata.
I am a complete beginner in programming, but have been able to learn a lot through this book. It breaks up the learning into many small pieces,...
laserlight:
Excellent touch breaking it up into functions and changing the values in the body. That solves my problem.
Thanks everyone for the help. Since I'm getting more and more interested in...
Here's a longer list of what I've learnt (roughly):
using header-files
functions
namespaces
cin
cout
using variables
data-types
member functions
const keyword
I see. Well, we are not allowed to use break yet. ;-)
Any other ideas how to solve this?
After some consideration, it strikes me that a for-loop could be used as an 'if'.
For example:
for (;x>y;;)
{cout << "x is bigger than y"}
for (;x<y;;)
{cout << "y is bigger than x"}
dwks:
That was a very informative reply and I understand how it works. We are not allowed to use this yet in the course though, since we must stick to what we've learned up to this point.
If...
Thank you very much for your reply. I will read it more thoroughly tomorrow.
Thanks for your reply.
Good idea to merge strings and numbers, that way I can reduce the number of lines a bit at least.
Concerning the if-sentences I am more curious in alternate ways of...
Hi.
I am trying to make a simple program, that receives two values from the user, and then prints a comment concerning the difference between these two values.
I was thinking something like this:...