Angel David Yaguana Hernandez
/
CPP_atof
atof uso y ejemplo
main.cpp@0:fb7e2db5576a, 2012-04-03 (annotated)
- Committer:
- sherckuith
- Date:
- Tue Apr 03 20:59:22 2012 +0000
- Revision:
- 0:fb7e2db5576a
descripcion de atof
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sherckuith | 0:fb7e2db5576a | 1 | #include "mbed.h" |
sherckuith | 0:fb7e2db5576a | 2 | /* atof example: sine calculator */ |
sherckuith | 0:fb7e2db5576a | 3 | #include <stdio.h> |
sherckuith | 0:fb7e2db5576a | 4 | #include <stdlib.h> |
sherckuith | 0:fb7e2db5576a | 5 | #include <math.h> |
sherckuith | 0:fb7e2db5576a | 6 | |
sherckuith | 0:fb7e2db5576a | 7 | int main () |
sherckuith | 0:fb7e2db5576a | 8 | { |
sherckuith | 0:fb7e2db5576a | 9 | double n,m; |
sherckuith | 0:fb7e2db5576a | 10 | double pi=3.1415926535; |
sherckuith | 0:fb7e2db5576a | 11 | char szInput [256]; |
sherckuith | 0:fb7e2db5576a | 12 | printf ( "Enter degrees: " ); |
sherckuith | 0:fb7e2db5576a | 13 | gets ( szInput ); |
sherckuith | 0:fb7e2db5576a | 14 | n = atof ( szInput ); |
sherckuith | 0:fb7e2db5576a | 15 | m = sin (n*pi/180); |
sherckuith | 0:fb7e2db5576a | 16 | printf ( "The sine of %f degrees is %f\n" , n, m ); |
sherckuith | 0:fb7e2db5576a | 17 | return 0; |
sherckuith | 0:fb7e2db5576a | 18 | } |