473,623 Members | 3,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP in a logical issue

How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divi sor) + 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 :/

Aug 29 '06 #1
4 2703
sonhado...@gmai l.com wrote:
How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divi sor) + 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

Aug 29 '06 #2
so********@gmai l.com wrote:
How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divi sor) + 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?

Aug 29 '06 #3
In article <11************ *********@i3g20 00cwc.googlegro ups.com>,
so********@gmai l.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.
Aug 29 '06 #4
posted:
How can I tell a computer, in C++, to give me the reminder on a
division problem?
If (Quotient)(Divi sor) + 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&pag e=stdlib.html#d iv

--

Frederick Gotham
Aug 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9255
by: whirl | last post by:
Hi. I really need some help on this one please. I am trying to print a 12.1 x 12.1cm box to my printer. I have found this code bit I just cant work out what the numbers mean. I know they are something to do with X/Y coordinates but what do the values actually mean . Printer.Line (1000, 2000)-(5000, 4000), vbRed, B
5
8735
by: PerritoPerron | last post by:
//I need a little help with this program, it runs but the output is not correct. //Can i get some help here please u fellas??? // This Program asks for user input like 1 && 0 and prints if it is true or false // it calculates the input to perform Logical operation from input #include <iostream> using namespace std;
34
7064
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. Yensao
6
3191
by: Alex Billerey | last post by:
Hi folks, Not sure that syntax is the right term but anyway... I'm currently working a a new section of a website and I want to make it as accessible as possible - hence the accesskey. On each page there will be around 15 links to other pages. Is there a standard way of marking up the accesskey attribute. Below is the code for the navbar section of the site, and as you can see
19
2353
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a subset of records across all tables is often considered a separate logical system, but sometimes may be treaded ar part of the global system, and there is not simply a 1-m-m... tree among the records in a logical database. Here's an example. A...
80
35083
by: Christopher Benson-Manica | last post by:
Of course one can get the effect with appropriate use of existing operators, but a ^^ operator would make for nice symmetry (as well as useful to me in something I'm working on). Am I the only one who would find it useful? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
2
7488
by: Ryan | last post by:
I'm trying to restore about 70 databases onto a new SQL server and wanted to script the creation and restore. I've done the creation with no problems, but on the restore, the logical names (of the original data) are all over the place and were historically wrong. So, when I use the script below... I've had to work out the Logical name for the data and the log file and alter the script accordingly. Creation ------------
16
2791
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and efficient navigating within Visual Studio 2005. Let's say your project (or solution) has dozens of forms and hundreds or even thousands of routines. Two Questions: 1) BUILT-IN to Visual Studio 2005. What ideas do you have to quickly
5
2082
by: Samik2003 | last post by:
Hello, The problem is my query is not extracting the correct xml data from the database : Is there something which I am missing?? ANy help would be appriciated. Thanks, Sam. THis is the query which I am using to extract :
2
5535
by: dbtwo | last post by:
Until today I always thought as long as you see a lot of logical reads as compared to physical reads, then you're good. But it looks like it isn't so. But doesn't logical read mean it's being read from memory and no I/O involved? So why is Logical Reads = CPU Consumption ? I ran into an exact scenario last week when our applciation were running something, and each time an application started, the CPU would go from 99% idle to 48% idle. I...
0
8221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8162
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6104
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5560
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4067
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.