can we assign float value to string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can we assign float value to string?

7th Oct 2016, 2:10 PM
ABHISHEK GOEL
ABHISHEK GOEL - avatar
2 Answers
0
try using explicit type casting. float f; string str=(string)f;
7th Oct 2016, 3:19 PM
APPORVA arya
APPORVA arya - avatar
0
float f = 23.5f; string s = std::to_string(f);
7th Oct 2016, 4:01 PM
kiwiyou
kiwiyou - avatar