C++ Help

....
Last edited on
What have you tried so far?

How much is (15732/100)*100?
you are so funny!!
look i am a young person and i dont know how to do these things yet... i will be pleased if u help me..
More to the point, what is
((15784+50)/100)*100

Sorry, Anastasistho, what we hope you will look up in a C++ reference is the phrase
"integer division" - it doesn't quite work as on your calculator, but it will be very helpful to you here.
i didnt know that you are such a funny person...
i checked but i didnt find anything like that i want
They have basically given you the answer here... you just have to realize what number to initialize as your variable and it's basically done.
(15732/100)*100 its still the same(15732)
((15784+50)/100)*100 its the same (15784+50)...
didnt understand..pls be more clear...You are teachers at universities and i am a student 15 years old..
Its not the same...Pls help me
(15732/100)*100 its still the same(15732)

Not really. Try writing some actual C++ code to test things out.
1
2
3
4
5
6
7
8
#include <iostream>

using namespace std;

int main() 
{
    cout << (15732/100)*100 << '\n';
}
15700

See the result? It is 15700, not 15732. That's because all the numbers are integers.

By the way no-one here is being funny, they are trying to help.
Last edited on
I am actually in programming one. but i can help you. post your actual program that you have so far and I can show you what you need to make it work. the only thing that the people before me are saying is that they want to see your work before helping you. so copy and paste EXACTLY what you have written in your code right now
and ps. the best programmer in my college class is 16 (not that that's important)
@chervil are you using VS? and if so how did you get it to copy over that way to this forum?
ok sorry.. now i understand..i want to apology to keskiverto and lastchance...Sorry guys..

Ok..Can i post it tommorow bcz in my country is 11pm and i closed the codeblocks?
and thanks for the help!!
Why somebody repory my posts?
@chervil are you using VS? and if so how did you get it to copy over that way to this forum?

It doesn't matter which compiler/IDE one uses. The source code is plain text. Just copy and paste the text.

To get the formatting use code tags
[code]your code here[/code]

See the <> button in the formatting menu, or type the tags yourself.
Last edited on
ok sorry.. now i understand..i want to apology to keskiverto and lastchance...Sorry guys..


No problem Anastasistho - it's great to have some 15 year olds learning to code.

I would encourage you to try what Chervil suggests and get your code to write out what C++ thinks the values of expressions are. You can cut and paste his code into your own environment and try changing values. You might also like to see what happens if you replace 15732 by 15732.0 in that example and see if you can explain the difference in output.

Try Keskiverto's original example, and later on mine, and you will get an idea of why we suggested them. Have a look through other posts as well and you could learn quite a lot.

There is a great tutorial on this site as well. It's well written, with examples, and it starts at a decent level.
Topic archived. No new replies allowed.