adding decimal (heeeeeeeeelp)

This is a discussion on adding decimal (heeeeeeeeelp) within the C++ Programming forums, part of the General Programming Boards category; Hi, Happy New Year!I'm newbie confronting a a small problem which seems big to me..:O In for loop i want ...

  1. #1
    Unregistered
    Guest

    Question adding decimal (heeeeeeeeelp)

    Hi,
    Happy New Year!I'm newbie confronting a a small problem which seems big to me..:O

    In for loop i want to add by 1 after the decimal point. for eg.
    for(rate=.05;rate<=6;rate++)
    now here the rate increases by 1 ie. 1.05,2.05 etc.

    But I want to increase it by 0.06,0.07 etc.

    Thankx for your help and time.

    please reply.......

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    194
    change rate++ to rate+= 0.01
    and make sure rate is defined as a double or a float

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I need help with decimal to binary Algorithm
    By webznz in forum C Programming
    Replies: 4
    Last Post: 03-13-2008, 03:52 AM
  2. SVN Import Causes Crash
    By Tonto in forum Tech Board
    Replies: 6
    Last Post: 11-01-2006, 02:44 PM
  3. hex to binary,hex to decimal
    By groovy in forum C Programming
    Replies: 2
    Last Post: 01-25-2006, 01:14 AM
  4. Confused by expression.
    By Hulag in forum C Programming
    Replies: 3
    Last Post: 04-07-2005, 07:52 AM
  5. decimal to binary, decimal to hexadecimal and vice versa
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 12-08-2001, 10:07 PM

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