-
Apr 15th, 2012, 08:24 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Small problem with computations
Code:
while (day1 != day2)
{
total = (result * 400) + total;
cout << total << endl;
day1++;
};
it won't work... the output i -81231231299 something...
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Apr 15th, 2012, 12:20 PM
#2
Re: Small problem with computations
Some more explanation about your issue would be needed.
Edit:
Have you set total as 0 before entering the loop ? Otherwise if you have just declared the variable (without assigning 0 as value) and summed value to it, then it might give you unexpected values as output. Because the compiler would assign a garbage value for that variable, if you don't assign anything.
Last edited by akhileshbc; Apr 16th, 2012 at 12:42 PM.
Reason: "light bulb" - found another possibility of the reason for this issue :)
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Apr 18th, 2012, 05:22 AM
#3
Thread Starter
Fanatic Member
Re: Small problem with computations
i found some syntax error in the upper part of my code.
thanks for the reply..
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|