Alittle help please

This is a discussion on Alittle help please within the C++ Programming forums, part of the General Programming Boards category; Hi there! can anyone help me or point me in the right direction, i am trying to code a calculator ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    59

    Alittle help please

    Hi there!

    can anyone help me or point me in the right direction,

    i am trying to code a calculator that will except floating point numbers upto 6 digits, including the decimal point...

    would i need a string to check each of the numbers to make sure the dont go over 6 digit limit??


    Thanks in advance

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Well both the scanf functions and cin have support for doing precision. But you could preprocess a string if you really wanted to.

    [edit]
    Alittle help please as a title is bad form, btw. Many people disreguard questions with this title.
    [/edit]

  3. #3
    Neoseeker's master master2000's Avatar
    Join Date
    Dec 2002
    Posts
    101
    all i know is use double for floating point #

    like this:

    void main()
    {
    double n1, n2, n3
    }
    then just program them in.

    try something like

    if(n1 = > 6)

    hope it helps
    missles on metriods

  4. #4
    Registered User Pioneer's Avatar
    Join Date
    Dec 2002
    Posts
    59
    You need to use a string to read the number, then convert it to a double when you've checked it for length.

  5. #5
    Neoseeker's master master2000's Avatar
    Join Date
    Dec 2002
    Posts
    101
    A little help please isn't a good name i suggest some random marks like this $&^%$%(&%$^#$$^&*%(^%^(&%
    missles on metriods

  6. #6
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Keep multiplying the number * 10 until there is no decimal point
    Code:
    while(int(num)!=num)
    {
       num*=10;
    }
    Then if this number divided by one million is less than zero then the original is 6 digits or less else it isn't.

    PS. I *think* this works but I haven't tested it!

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Yes, we all know the thread title isn't the best choice, hopefully boontune will choose more wisely next time.

    @master2000
    void main() is wrong, please don't promote its use.
    And please do not make further posts like this one:
    A little help please isn't a good name i suggest some random marks like this $&^%$%(&%$^#$$^&*%(^%^(&%
    I suggest you read the forum guidelines. Any questions, PM me.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Registered User
    Join Date
    Oct 2002
    Posts
    59
    Thanks alot for your help guys,

    Im sorrry about the heading, i will rethink it next time

    Cheers again!

  9. #9
    Neoseeker's master master2000's Avatar
    Join Date
    Dec 2002
    Posts
    101
    Originally posted by Hammer
    Yes, we all know the thread title isn't the best choice, hopefully boontune will choose more wisely next time.

    @master2000
    void main() is wrong, please don't promote its use.
    And please do not make further posts like this one:

    I suggest you read the forum guidelines. Any questions, PM me.
    sorry

    also i always use void main()
    Last edited by master2000; 12-10-2002 at 01:51 PM.
    missles on metriods

  10. #10
    Neoseeker's master master2000's Avatar
    Join Date
    Dec 2002
    Posts
    101
    Originally posted by boontune
    Thanks alot for your help guys,

    Im sorrry about the heading, i will rethink it next time

    Cheers again!

    just add the word baloonies
    missles on metriods

  11. #11
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I usually use float main().

  12. #12
    Neoseeker's master master2000's Avatar
    Join Date
    Dec 2002
    Posts
    101
    what do you use it for?
    missles on metriods

  13. #13
    Evil Sock Puppet MadHatter's Avatar
    Join Date
    Nov 2002
    Posts
    176
    >what do you use it for?
    i usually use it when i want to brush up on my bad programming habbits. void main() also helps with those.

  14. #14
    Neoseeker's master master2000's Avatar
    Join Date
    Dec 2002
    Posts
    101
    how does that cure habits?????????


    --shish--

    void main() curing habits

    --god help this kid--
    missles on metriods

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alittle help for a beginner please...
    By Xeavor in forum C++ Programming
    Replies: 23
    Last Post: 09-24-2004, 02:10 AM
  2. Noobie <-- alittle help /w compiler
    By Bean0578 in forum C++ Programming
    Replies: 4
    Last Post: 08-28-2004, 09:22 PM
  3. alittle help please
    By boontune in forum C++ Programming
    Replies: 3
    Last Post: 10-02-2002, 04:21 PM
  4. need alittle help
    By xlordt in forum Linux Programming
    Replies: 1
    Last Post: 02-14-2002, 10:53 AM
  5. Please alittle help-- if/else
    By jill in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2001, 06:13 PM

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