Answer to Question #31372 in C++ for Jay

Question #31372
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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS