68 338
Assignments Done
98,8%
Successfully Done
In November 2018

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.
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions