Positive integers

This is a discussion on Positive integers within the C++ Programming forums, part of the General Programming Boards category; HI, I am relativly new to c ++ and was wondering if there was a function that I could use ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    9

    Unhappy Positive integers

    HI,

    I am relativly new to c ++ and was wondering if there was a function that I could use that will always return a positive integer. For example if I did 1- 5 it would return 4 instead of -4.

    Thank you in Advance

    Craig Smith

  2. #2
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    Posts
    330
    abs()

    The absolute value function, found in <math.h>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  2. find the totals of positive and negative integers
    By noaksey in forum C Programming
    Replies: 5
    Last Post: 05-11-2004, 02:59 PM
  3. Help with homework please
    By vleonte in forum C Programming
    Replies: 20
    Last Post: 10-13-2003, 12:16 PM
  4. how to handle integer overflow in C
    By kate1234 in forum C Programming
    Replies: 8
    Last Post: 04-23-2003, 01:20 PM
  5. Replies: 6
    Last Post: 11-04-2002, 05:11 PM

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