Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,262 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,511 people online right now. Registration is fast and FREE... Join Now!




remainders

 
Reply to this topicStart new topic

remainders

jayhuang
15 Oct, 2006 - 05:18 PM
Post #1

New D.I.C Head
*

Joined: 11 Oct, 2006
Posts: 31


My Contributions
rolleyes.gif

Guess the results to the following:

1. 6 % 3.0

2. 6 % -3

3. -6 % 3
User is offlineProfile CardPM
+Quote Post

NyeNye
RE: Remainders
15 Oct, 2006 - 05:22 PM
Post #2

D.I.C Head
**

Joined: 24 Sep, 2006
Posts: 248


My Contributions
is this a programming question??
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Remainders
15 Oct, 2006 - 05:47 PM
Post #3

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,230



Thanked: 40 times
Dream Kudos: 25
My Contributions
Homework questions I would surmise...a lesson on the use and results of using the modulus operator.
User is offlineProfile CardPM
+Quote Post

jayhuang
RE: Remainders
15 Oct, 2006 - 06:09 PM
Post #4

New D.I.C Head
*

Joined: 11 Oct, 2006
Posts: 31


My Contributions
QUOTE(Amadeus @ 15 Oct, 2006 - 06:47 PM) *

Homework questions I would surmise...a lesson on the use and results of using the modulus operator.


lol, you guys never tried to answer? I am not looking for hw answers. Even if I do, I can easily put them into compiler to get the answers.

Here is the answers:

1. undefined

2. 0

3. 0
User is offlineProfile CardPM
+Quote Post

gregoryH
RE: Remainders
16 Oct, 2006 - 01:54 AM
Post #5

D.I.C Regular
Group Icon

Joined: 4 Oct, 2006
Posts: 417


Dream Kudos: 50
My Contributions
QUOTE(jayhuang @ 15 Oct, 2006 - 07:09 PM) *

QUOTE(Amadeus @ 15 Oct, 2006 - 06:47 PM) *

Homework questions I would surmise...a lesson on the use and results of using the modulus operator.


lol, you guys never tried to answer? I am not looking for hw answers. Even if I do, I can easily put them into compiler to get the answers.

Here is the answers:

1. undefined

2. 0

3. 0

guess appears to be the operative word....

does the compiler or program convert any values?
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Remainders
16 Oct, 2006 - 03:33 AM
Post #6

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,914



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
QUOTE
lol, you guys never tried to answer? I am not looking for hw answers. Even if I do, I can easily put them into compiler to get the answers.

You aren't the only one with a compiler out here.... wink2.gif

Besides, there is no need to even have one.
The modulus operator is not defined for floating point variables.
The MOD operator is actually implemented by accessing the EDX Register after calling the IDIV/DIV Instruction. These Instructions are not designed to work on floating point numbers.

And the FDIV Instruction doesn't return the modulus of the number...So the % operator on float numbers doesn't work.

Your post really did look like a Homework Question.
Be more specific next time.

And just because nobody replies, doesn't mean that they don't know it...Your post didn't specify whether you were asking or testing wink2.gif
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 07:01PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month