Results 1 to 2 of 2

Thread: Computer programming

  1. #1
    Super Member
    Feb 2008

    Computer programming

    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:

    double cost(string);

    int main()
    cout << "Hello" << cost;

    double cost(string)
    cout << "Enter the cost of the item\n";
    cin >> cost;
    cout << "You entered " << cost << endl;
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Apr 2008
    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.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. How do i get LaTex on my computer
    Posted in the Math Software Forum
    Replies: 7
    Last Post: Mar 7th 2011, 01:21 PM
  2. Computer Science
    Posted in the Advanced Math Topics Forum
    Replies: 2
    Last Post: Aug 7th 2009, 05:06 PM
  3. Replies: 1
    Last Post: Nov 17th 2008, 03:18 AM
  4. Replies: 2
    Last Post: May 20th 2008, 02:02 PM
  5. Computer networking
    Posted in the Algebra Forum
    Replies: 1
    Last Post: Aug 10th 2007, 11:31 PM

Search Tags

/mathhelpforum @mathhelpforum