/* File: real2str.c Converting a real number to a string and vice versa. */ #include #include #include "genlib.h" #include "simpio.h" #include "strlib.h" main() { string str1, str2 ; double x1, x2 ; printf("Input a real number: ") ; x1 = GetReal() ; str1 = RealToString(x1) ; printf("String version of x1 is: %s\n", str1) ; printf("Input a string: ") ; str2 = GetLine() ; x2 = StringToReal(str2) ; printf("Double version of str2 is: %g\n", x2) ; }