|
-
Jan 30th, 2008, 08:27 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Maths question
Hi guys,
I was wondering whether this was possible in C++?
I have an integer that i was to divide by 25, but i only want the number of times the 'full' 25 can fit into the integer i have.
For example if the integer i have is 51, it will return 2.
I hope this makes sense.
Thanks in advance for any help.
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Jan 30th, 2008, 08:38 AM
#2
Re: Maths question
As long as the variable that will hold the result is an integer, it simply "cut off" the decimals after the division:
vb Code:
int x = 51;
int y = 25;
int z = x / y;
z will contain 2.
-
Jan 30th, 2008, 08:41 AM
#3
Thread Starter
Fanatic Member
Re: Maths question
Ok kool. Thanks. Will it not round the number up or down???
Thanks again.
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Jan 30th, 2008, 09:03 AM
#4
Re: Maths question
 Originally Posted by Kimmy4
Ok kool. Thanks. Will it not round the number up or down???
Thanks again.
It wont round, it will simply (I've lost the word for it) "cut off" the decimals.
-
Jan 30th, 2008, 09:04 AM
#5
Thread Starter
Fanatic Member
Re: Maths question
Ok kool, i'll have to try and remember that for next time.
Thanks again.
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Jan 30th, 2008, 11:24 AM
#6
Re: Maths question
 Originally Posted by Atheist
It wont round, it will simply (I've lost the word for it) "cut off" the decimals.
Truncate I believe would be the word you're looking for.
-
Jan 30th, 2008, 11:45 AM
#7
Re: Maths question
 Originally Posted by kfcSmitty
Truncate I believe would be the word you're looking for.
Thank you thats the word
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
|