Thread: Help with calculating

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    3

    Help with calculating

    i am making a program that's calculate Meters Per Second into Kilometers Per Hour.. i used this piece of code to do the calculate:

    Code:
    void __fastcall Tmpstokmph::calculate(TObject *Sender)
    {
    kmph->Text = FloatToStrF((StrToFloat (mps * 60) * 60) / 1000, ffNumber, 4 , 10);
    }
    But if i compile it it's say: Illigel use of pointers.

    I can't solve it.. can any1 help me plz? (For if u need some info, i just started the Windows C++)

    PS: kmph and mps are both names of text fields, so u know it

  2. #2
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    edit: I didn't see your last line, so mps is text

    (StrToFloat (mps)* 60 * 60)/1000 ...

    You can't multiply text by a number as you did ( mps * 60)
    Last edited by Darryl; 08-04-2005 at 09:08 AM.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    3
    nope that's not it, because i want the mps variable multiplies with 60, and that answer must be multiplied with 60, and that answer must be divided by 1000

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    3
    oh, finally my dad helpd me, the thing in the Bold is the thing i forgot
    Code:
    void __fastcall Tmpstokmph::calculate(TObject *Sender)
    {
    kmph->Text = FloatToStrF((StrToFloat (mps->Text * 60) * 60) / 1000, ffNumber, 4 , 10);
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calculating : high numbers
    By MiraX33 in forum C++ Programming
    Replies: 9
    Last Post: 06-08-2006, 11:08 PM
  2. Calculating CPU Usage
    By vitaliy in forum Linux Programming
    Replies: 3
    Last Post: 08-21-2005, 09:38 AM
  3. Recursion
    By Lionmane in forum C Programming
    Replies: 11
    Last Post: 06-04-2005, 12:00 AM
  4. Taking input while calculating
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 07-12-2002, 04:47 PM
  5. Calculating window sizes
    By Mox in forum Windows Programming
    Replies: 3
    Last Post: 11-08-2001, 09:17 PM