Return a string function

Hi, I need help to understand more about a function which uses a string. eg.
string getprice(double& double) where the 2 arguments are initial price and number of bidding.

How do I return a string to the function? Please guide me thank you.
If you don't know what your own function is supposed to do, how could we ?

Maybe the function should compute the total price and write its value into a human readable format for later display ?
It returns the name of the final bidder.
> How do I return a string to the function?

How do I return a string from a function? By making std::string as its result type.

1
2
3
4
5
6
7
8
#include <string>

std::string function_returning_a_string()
{
    std::string str = "whatever" ;
    // ...
    return str ;
}


http://www.mochima.com/tutorials/strings.html
Topic archived. No new replies allowed.