Click here to Skip to main content
15,922,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what function will convert a char to its number value Pin
johnstonsk11-Jul-03 10:26
johnstonsk11-Jul-03 10:26 
GeneralRe: what function will convert a char to its number value Pin
John R. Shaw14-Jul-03 7:23
John R. Shaw14-Jul-03 7:23 
AnswerRe: what function will convert a char to its number value Pin
Mike Dimmick11-Jul-03 9:47
Mike Dimmick11-Jul-03 9:47 
GeneralRe: what function will convert a char to its number value Pin
Daniel Turini11-Jul-03 10:15
Daniel Turini11-Jul-03 10:15 
GeneralRe: what function will convert a char to its number value Pin
Mike Dimmick11-Jul-03 12:19
Mike Dimmick11-Jul-03 12:19 
GeneralRe: what function will convert a char to its number value Pin
Daniel Turini11-Jul-03 23:48
Daniel Turini11-Jul-03 23:48 
GeneralRe: what function will convert a char to its number value Pin
Mike Dimmick12-Jul-03 1:16
Mike Dimmick12-Jul-03 1:16 
AnswerRe: what function will convert a char to its number value Pin
drabudawood13-Jul-03 20:12
drabudawood13-Jul-03 20:12 
/* ATOF.C: This program shows how numbers stored
* as strings can be converted to numeric values
* using the atof, atoi, and atol functions.
*/

#include <stdlib.h>
#include <stdio.h>

void main( void )
{
char *s; double x; int i; long l;

s = " -2309.12E-15"; /* Test of atof */
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x );

s = "7.8912654773d210"; /* Test of atof */
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x );

s = " -9885 pigs"; /* Test of atoi */
i = atoi( s );
printf( "atoi test: ASCII string: %s\t\tinteger: %d\n", s, i );

s = "98854 dollars"; /* Test of atol */
l = atol( s );
printf( "atol test: ASCII string: %s\t\tlong: %ld\n", s, l );
}


Output

atof test: ASCII string: -2309.12E-15 float: -2.309120e-012
atof test: ASCII string: 7.8912654773d210 float: 7.891265e+210
atoi test: ASCII string: -9885 pigs integer: -9885
atol test: ASCII string: 98854 dollars long: 98854


Smile | :)

Dr Abudawood
QuestionWhy is the constructor protected ? Pin
Shay Harel11-Jul-03 7:25
Shay Harel11-Jul-03 7:25 
AnswerRe: Why is the constructor protected ? Pin
John M. Drescher11-Jul-03 7:40
John M. Drescher11-Jul-03 7:40 
GeneralRe: Why is the constructor protected ? Pin
Shay Harel11-Jul-03 7:43
Shay Harel11-Jul-03 7:43 
GeneralRe: Why is the constructor protected ? Pin
John M. Drescher11-Jul-03 7:50
John M. Drescher11-Jul-03 7:50 
GeneralRe: Why is the constructor protected ? Pin
Shay Harel11-Jul-03 7:52
Shay Harel11-Jul-03 7:52 
GeneralRe: Why is the constructor protected ? Pin
John M. Drescher11-Jul-03 7:55
John M. Drescher11-Jul-03 7:55 
GeneralRe: Why is the constructor protected ? Pin
Anthony_Yio15-Jul-03 1:27
Anthony_Yio15-Jul-03 1:27 
QuestionI don&#8217;t&#8217; know how I can find the character set like it? Pin
Alice8011-Jul-03 7:20
Alice8011-Jul-03 7:20 
AnswerRe: I don&#8217;t&#8217; know how I can find the character set like it? Pin
Mike Dimmick11-Jul-03 10:02
Mike Dimmick11-Jul-03 10:02 
GeneralRe: I don&#8217;t&#8217; know how I can find the character set like it? Pin
Alice8012-Jul-03 1:54
Alice8012-Jul-03 1:54 
GeneralRe: I don&#8217;t&#8217; know how I can find the character set like it? Pin
Mike Dimmick12-Jul-03 2:12
Mike Dimmick12-Jul-03 2:12 
AnswerRe: I don&#8217;t&#8217; know how I can find the character set like it? Pin
Anthony_Yio15-Jul-03 1:33
Anthony_Yio15-Jul-03 1:33 
GeneralLinked list Pin
DaveE9th11-Jul-03 6:57
DaveE9th11-Jul-03 6:57 
GeneralRe: Linked list Pin
David Crow11-Jul-03 7:06
David Crow11-Jul-03 7:06 
GeneralRe: Linked list Pin
DaveE9th12-Jul-03 2:24
DaveE9th12-Jul-03 2:24 
GeneralRe: Linked list Pin
John M. Drescher11-Jul-03 7:20
John M. Drescher11-Jul-03 7:20 
GeneralRe: Linked list Pin
DaveE9th11-Jul-03 8:24
DaveE9th11-Jul-03 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.