What does the "1" do in string() in this line?
answer = string(1,'0'+i%10) + answer;
What library is this function coming from?
sorry - this is using <string> in C++ ..
I think.. I am really confused. Teacher posted it as part of a solution to an exercise we did. I did something different so I am trying to figure out what this means.
Ok, now I know what your doing.
The string function is an overloaded constructor. In this case there are two parameters. The first parameter is the number of times the second parameter is repeated. Therefore,
string(1,'H') => "H"
string(2,'H') => "HH"
The string constructor also has a one parameter function like so:
string('H') => "H"
ah! ok, thanks so much!!!
Separate names with a comma.