c++ questions
You might want to try researching a little by yourself before posting but, since I'm ecstatic that I know the answer, I'm going to try and help.
- What's the difference between int and double? int is only real counting numbers. IE: 1,2,3,4 etc dbl is all the numbers in between. IE: 1.2, 1.3, 1.4 etc
- Why does 12% 5=2? % is the way C++ displays modulous. I don't really know how to explain it other than saying it's the remainder. 5 goes into 12 2 times (10) with 2 left over. Thus 12% 5=2. If you know any VB, it is the same as MOD.
Hope I helped. If I'm wrong about modulous, feel free to correct me. (I don't think I am)
…Didn't I just explain this? Ok, I'm sure it was unclear and/or confusing.
% finds the remainder- the leftovers, if you will.
5 goes into 12 how many times?
2.
5*2=10.
12-10=2.
12%5=2.
@Yours3lf Maybe-just maybe, I started writing my answer before you, but took the time to be thorough and check my spelling, allowing you to post your crap before me? Nah, that's not possible. I must have just copied your beautiful answer.
yours31f wrote: as far as i can tell it should be
20 % 21 = 1 <— only thing i could see wrong
Why on earth would the remainer of 20 divided by 21 be 1? 21 goes into 20… 0 times, with a remainder of 20.
Other than that, decent explanations on double vs. int and modulus… as a further course of action, I would suggest a book on beginning C++.
Go to the microsoft home page. Then browse to the C++ video training. They start off with basic syntax and basic logic.
Better get to work if your final is in C++…
EDIT: whoops. I thought you said somewhere it was C++, but it turns out it was Zephyr_Pure's post. microsoft will still get you through what you need though.