0

I have the following piece of code which works fine

data[person].history[data[person].trans]= "CASH WITHDRAWAL 100.00 GBP";

but how would I write it so instead of 100.00 it inputs a float called safe_input2

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by berwick53
0

Assuming we're talking about a std::string object and not a pointer to char:

stringstream ss;

ss<<"CASH WITHDRAWAL "<< safe_input2 <<" GBP";
data[person].history[data[person].trans] = ss.str();
0

Assuming we're talking about a std::string object and not a pointer to char:

stringstream ss;

ss<<"CASH WITHDRAWAL "<< safe_input2 <<" GBP";
data[person].history[data[person].trans] = ss.str();

Thanks for the help, I'm still getting used to C++.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.