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 :/ 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 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?
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.
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
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;
|
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
|
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
|
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...
| |
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.
|
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
------------
|
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
|
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 :
|
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...
|
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...
| |
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,...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |