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

Recommended Answers

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();
Jump to Post

All 2 Replies

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();

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++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.