Angel David Yaguana Hernandez / Mbed 2 deprecated CPP_atof

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 /* atof example: sine calculator */
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 #include <math.h>
00006 
00007 int main ()
00008 {
00009   double n,m;
00010   double pi=3.1415926535;
00011   char szInput [256];
00012   printf ( "Enter degrees: " );
00013   gets ( szInput );
00014   n = atof ( szInput );
00015   m = sin (n*pi/180);
00016   printf ( "The sine of %f degrees is %f\n" , n, m );
00017   return 0;
00018 }