![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hey, I'm trying to do a simple calculator to add up 2 sets of numbers together using C18. The number is entered using a keypad and displayed onto the LCD. Lets say I want to calculate 101 + 50, I would first enter '1', '0', '1' using the keypad. The character '1', would then be stored in the first position of an array followed by '0' and then '1' in the 3rd position of the array. If I want to use the MCU's arithmetic function to add the numbers, i need to convert these characters in the array into 'int variable' of 101. So, my question is how do I convert character '1', '0', '1' stored in the char array into int 101. Is there any built in function that enables me to do that apart from writting my own code..? Thanks. | |
| |
| | (permalink) |
| You can convert string to int using the atoi function. http://www.cplusplus.com/reference/c...dlib/atoi.html Last edited by colin mac; 14th August 2008 at 11:57 AM. | |
| |
| | (permalink) |
| ah.. thanks for that.. | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| calculator | chinmay7 | Micro Controllers | 1 | 14th October 2007 01:45 PM |
| calculator | sara_6252 | Micro Controllers | 8 | 1st June 2007 03:29 AM |
| Calculator!!! | Gaurav Varshney | Micro Controllers | 1 | 6th May 2007 07:15 AM |
| help with Calculator LCD | aryyy | Micro Controllers | 4 | 17th July 2006 11:25 AM |
| calculator | maria | Electronic Projects Design/Ideas/Reviews | 2 | 16th June 2003 05:00 PM |