HELP in a logical issue



 DEVELOP > c-Plus-Plus > HELP in a logical issue

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: ""
Date: 28 Aug 2006 10:05:19 PM
Object: HELP in a logical issue
How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divisor) + Reminder = Dividend
How do I get the reminder by itself?
How do I tell C++ that I want the reminder.
If I write
quot = num2/num1; It won't give me the reminder.
Thank you for your help.
Roberto Millan, frustrated programmer :/
.

User: "Frederick Gotham"

Title: Re: HELP in a logical issue 29 Aug 2006 07:44:53 AM
posted:

How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divisor) + Reminder = Dividend
How do I get the reminder by itself?
How do I tell C++ that I want the reminder.
If I write
quot = num2/num1; It won't give me the reminder.
Thank you for your help.
Roberto Millan, frustrated programmer :/

If you want both, then consider "div":
http://www.dinkumware.com/manuals/?
manual=compleat&Search=div&page=stdlib.html#div
--
Frederick Gotham
.

User: "red floyd"

Title: Re: HELP in a logical issue 28 Aug 2006 11:51:17 PM
wrote:

How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divisor) + Reminder = Dividend
How do I get the reminder by itself?
How do I tell C++ that I want the reminder.
If I write
quot = num2/num1; It won't give me the reminder.
Thank you for your help.
Roberto Millan, frustrated programmer :/

What book are you reading that doesn't mention the % (modulo) operator?
.

User: "Thomas Tutone"

Title: Re: HELP in a logical issue 28 Aug 2006 10:10:45 PM
wrote:

How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divisor) + Reminder = Dividend
How do I get the reminder by itself?
How do I tell C++ that I want the reminder.
If I write
quot = num2/num1; It won't give me the reminder.
Thank you for your help.
Roberto Millan, frustrated programmer :/

In C++ (and in C), the modulo operator is %. It gives the "remainder"
of an integral division. For example:
int i = 7 % 3; // i is now equal to 1, which is the remainder of 7
divided by 3.
Best regards,
Tom
.

User: "Jerry Coffin"

Title: Re: HELP in a logical issue 29 Aug 2006 01:58:17 AM
In article <1156820719.525645.21770@i3g2000cwc.googlegroups.com>,
sonhadorPR@gmail.com says...

How can I tell a computer, in C++, to give me the reminder on a
division problem?

C++ provides the modulus operator (%), which will generally do the job.
If you have to deal with negative numbers, you may need to do a little
extra work to get exactly what you want though.
--
Later,
Jerry.
The universe is a figment of its own imagination.
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER