Angel David Yaguana Hernandez
/
CPP_atof
atof uso y ejemplo
Diff: main.cpp
- Revision:
- 0:fb7e2db5576a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 03 20:59:22 2012 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +/* atof example: sine calculator */ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +int main () +{ + double n,m; + double pi=3.1415926535; + char szInput [256]; + printf ( "Enter degrees: " ); + gets ( szInput ); + n = atof ( szInput ); + m = sin (n*pi/180); + printf ( "The sine of %f degrees is %f\n" , n, m ); + return 0; +} \ No newline at end of file