Mar 9, 2002 #1 sheila11 Programmer Joined Dec 27, 2000 Messages 251 Location US Hi all, I have numbers (0 to 9) in a char array ( e.g. char deg[] = {'2','3'} that I need to convert to int values. How can I do this? TIA, Sheila
Hi all, I have numbers (0 to 9) in a char array ( e.g. char deg[] = {'2','3'} that I need to convert to int values. How can I do this? TIA, Sheila
Mar 9, 2002 #2 Leibnitz Programmer Joined Apr 6, 2001 Messages 393 Location CA Here is how you can do it: #include <iostream> using namespace std; void main() { char array[9] = "Hello !"; for( int i = 0; i < 9; i++ ) cout<<array<<" = "<< __toascii( array )<<" "; } Upvote 0 Downvote
Here is how you can do it: #include <iostream> using namespace std; void main() { char array[9] = "Hello !"; for( int i = 0; i < 9; i++ ) cout<<array<<" = "<< __toascii( array )<<" "; }
Mar 9, 2002 Thread starter #3 sheila11 Programmer Joined Dec 27, 2000 Messages 251 Location US Thanks, Leibnitz. Sheila Upvote 0 Downvote