CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Numerical calculations

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
FishBone
Guest







Numerical calculations
PostPosted: Thu May 14, 2009 12:20 am     Reply with quote

I'm new to this forum but i am willing to learn.Rolling Eyes

If user enter on the keypad:
12.50 ( 1 2 dot 5 0 )

- How to format entered number so that it's 12.50 and not 1 2 . 5 0 or something in this matter ?

- How to process/calculate 12 dot 50 * 0.50 = 6.25

- How to write calculated value to ram ?

Regards.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 14, 2009 12:58 am     Reply with quote

Quote:

How to format entered number so that it's 12.50 and not 1 2 . 5 0 or
something in this matter ?

See this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=36304&start=2
Except instead of atoi(), use the atof() function. It will convert
a string of ascii numbers into a floating point value. These functions
are described in the CCS manual, and on the internet (use Google).

Quote:
- How to process/calculate 12 dot 50 * 0.50 = 6.25

You now have the keypad value in a 'float' variable. Multiply it by 0.50
and store the result.

Quote:
- How to write calculated value to ram ?

You need to learn the C language. It's a pre-requisite for this forum.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group