My function will take a string parameter and return a double. It has to prompt the user to answer a question so the answer is a number. I don't know what to do. (Nothing can happen in main...only calls functions) Any advice? This is what ive got:
cout << "Hello" << cost;
cout << "Enter the cost of the item\n";
cin >> cost;
cout << "You entered " << cost << endl;
Sep 22nd 2008, 03:21 PM
I would ask a question that has only a finite number of answers so that you can handle converting the string answers to doubles with a "switch" statement.