Question about operators.

This is a discussion on Question about operators. within the C++ Programming forums, part of the General Programming Boards category; I'm following a tutorial at http://cplusplus.com/doc/tutorial/tut1-3.html and the problem is that I don't understand the description of an operator called ...

  1. #1
    In your face... ha ha ha Liger86's Avatar
    Join Date
    Dec 2002
    Location
    Motorcity Capital
    Posts
    321

    Question Question about operators.

    I'm following a tutorial at http://cplusplus.com/doc/tutorial/tut1-3.html and the problem is that I don't understand the description of an operator called module (%).

    The description that they give there is I believe got a mistake (I just don't know what mistake).

    The only one that may not be known by you is the module, specified with the percentage sign (%). Module is the operation that gives the rest of a division of two integer values. For example, if we write a = 11 % 3;, the variable a will contain 2 as result since 2 is the rest from dividing 11 between 3.
    That was from that site, and I don't get it?

    Anyone? PLS HLP
    From Ukraine with love!

    Internationally known widely respected

    - Digitally yourz -

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    % does an integer division, throws away the quotient and returns the remainder.
    / does an integer division, throws away the remainder and returns the quotient.

    21/5 = 4
    21%5 =1

    get it?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    If you are doing normal devision using a paper and a pencil... You'll get two things:
    The result, and the remainder...
    The / operator will give you the result, and the & operator will give you the remainder.

    What is it that is not clear?
    none...

  4. #4
    In your face... ha ha ha Liger86's Avatar
    Join Date
    Dec 2002
    Location
    Motorcity Capital
    Posts
    321
    no no, its clear all-right!

    thanks but could I get some more examples.
    From Ukraine with love!

    Internationally known widely respected

    - Digitally yourz -

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 01:14 PM
  2. Bolean Operators hurt my head. (Trouble understanding) :(
    By Funcoot in forum C++ Programming
    Replies: 3
    Last Post: 01-20-2008, 07:42 PM
  3. operators???
    By arjunajay in forum C++ Programming
    Replies: 11
    Last Post: 06-25-2005, 05:37 AM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21