Angel David Yaguana Hernandez
/
CPP_cstdlib_stdlib
stdlib
main.cpp@0:3aa31e7fe98c, 2012-04-03 (annotated)
- Committer:
- sherckuith
- Date:
- Tue Apr 03 21:00:05 2012 +0000
- Revision:
- 0:3aa31e7fe98c
descripcion y ejemplo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sherckuith | 0:3aa31e7fe98c | 1 | #include "mbed.h" |
sherckuith | 0:3aa31e7fe98c | 2 | |
sherckuith | 0:3aa31e7fe98c | 3 | /* atoi example */ |
sherckuith | 0:3aa31e7fe98c | 4 | #include <stdio.h> |
sherckuith | 0:3aa31e7fe98c | 5 | #include <stdlib.h> |
sherckuith | 0:3aa31e7fe98c | 6 | |
sherckuith | 0:3aa31e7fe98c | 7 | int main () |
sherckuith | 0:3aa31e7fe98c | 8 | { |
sherckuith | 0:3aa31e7fe98c | 9 | int i; |
sherckuith | 0:3aa31e7fe98c | 10 | char szInput [256]; |
sherckuith | 0:3aa31e7fe98c | 11 | printf ("Enter a number: "); |
sherckuith | 0:3aa31e7fe98c | 12 | fgets ( szInput,5, stdin );//char * fgets ( char * str, int num, FILE * stream ); |
sherckuith | 0:3aa31e7fe98c | 13 | i = atoi (szInput); |
sherckuith | 0:3aa31e7fe98c | 14 | printf ("The value entered is %d. The double is %d.\n",i,i*2); |
sherckuith | 0:3aa31e7fe98c | 15 | return 0; |
sherckuith | 0:3aa31e7fe98c | 16 | } |