I get an output in this piece of code
bbb 55 66 77 88 aaa
I hope the output
BBB 55 6677 88bbb
Because I ss < / Code> to
log [0]
to log [1]
So my question is, what is the output that differs from what I expect and how do I change it?
int w, x, y, z; Stringstream ss (string stream :: in | stringstream :: out); String word; String log [2]; Log [0] = "aaa 11 22 33 44"; Log [1] = "BBB 55 66 77 88"; Ss & lt; & Lt; People [0]; SS & gt; & Gt; word; Int k = 0; SS & gt; & Gt; W & gt; & Gt; X & gt; & Gt; Y & gt; & Gt; Z; K ++; Ss & lt; & Lt; [K] Login to the court & lt; & Lt; People [k] & lt; & Lt; Endl; SS & gt; & Gt; word; The court's & lt; & Lt; The word & lt; & Lt; Endl; Return 0;
when
SS & gt; & Gt; W & gt; & Gt; X & gt; & Gt; Y & gt; & Gt; Z;
was executed, but no material has been left to work and ss.good () returns false returns, to assure everyone that ss.clear () Expresses the need to call it OK and we can move forward.
However, given that you do
ss.clear (); Ss & lt; & Lt; [K] Login
will be the contents of the SS
aaa 11 22 33 44bbb 55 66 77 88
If you want it to be okay in this way, but it may be that you
BBB 55 66 77 88
to
Pre> ss.str (log [k]); Ss.clear ();
Comments
Post a Comment