What does this code mean ? What is the stringstream use of and its resemblance in this code . Can anyone tell me ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does this code mean ? What is the stringstream use of and its resemblance in this code . Can anyone tell me ?

if(vec.size()!=0) { stringstream ss(vec[vec.size()-1].stocks[0]); int temp; ss>>temp; temp+=1; ss.clear(); ss<<temp; write[0] = ss.str(); }

5th Apr 2018, 5:13 AM
Saurabh Kumar Kar
Saurabh Kumar Kar - avatar
2 Answers
+ 1
What is the overall code supposed to do? Can you send the full code?
5th Apr 2018, 10:16 AM
Timon Paßlick
+ 1
stringstream is a special class that allows us to treat a string as a buffer for a stream. This is useful when you wish to convert data to/from a string and apply stream functions and manipulators at the same time. For more info : www.cplusplus.com/reference/sstream/stringstream
5th Apr 2018, 2:22 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar