Thread: Incrementing a Dollar amount

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    2

    Incrementing a Dollar amount

    All,
    I am new programmer to C. Can anyone help me.
    Here is my question :
    I have a dollar amount of $23444.65
    Now I have to put this dollar amount into a variable and when ever I run my script the variable should be incremented by 1.
    Example : If my variable is $23444.65 on first run output should be $23445.65
    on next run output should be $23446.65 and next run output should be $23447.65.

    Can anyone help me to write a simple function for this in C coding.
    and where can I test this code.(like any free C Compilers).
    As I am new to C programming I dont know any basics of C.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You should probably get a book, then.
    A variable to store that must be a float or double.
    Incrementing is done easily via var++.

    Free IDEs:
    http://cpwiki.sf.net/IDE
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    2
    do you know any free C compilers

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Google for it, and you'll find them. IDE's come with a compiler, of course.

    Microsoft's free version of Visual C is a popular choice.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by vamshiy View Post
    do you know any free C compilers
    Check the link. IDEs do usually come with compilers.
    Visual Studio is a set up & go with all you need, but it's for Windows. I can't say what OS you have.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You could also try Dev-C++, if you're on Windows.

    If you're on Linux, you likely already have gcc, a command-line C compiler. Search for some gcc tutorials. For a Mac, you could try installing Xcode.

    I'd be willing to bet that the OP is using Windows, though.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Determing the amount of change(money)
    By Kyeong in forum C Programming
    Replies: 11
    Last Post: 09-30-2008, 04:36 PM
  2. Newbie Help: Currency Converter
    By Ashfury in forum C Programming
    Replies: 10
    Last Post: 11-06-2005, 01:21 PM
  3. confused
    By mopar123 in forum C Programming
    Replies: 18
    Last Post: 09-01-2005, 04:06 PM
  4. Having a problem!
    By Zildjian in forum C++ Programming
    Replies: 6
    Last Post: 10-18-2004, 09:40 AM
  5. Replies: 10
    Last Post: 06-26-2003, 08:26 AM