write a function double get_double(string promt) that displays the prompt string, followed by a space, reads a floating-point number in, and returns it.
1
Expert's answer
2013-06-03T08:40:25-0400
#include <iostream> #include <string>
using namespace std;
float get_double(string promt){ return atof(promt.c_str()); } //main function int main() { //input string string input=""; cout<<"Enter string: "; cin>>input; //show result cout<<get_double(input); return 0; }
Comments
Leave a comment