2016-10-19 4 views

答えて

0

istreamstreamは、ストリームから多くの文字を抽出し、fit into the target datatype(算術型を参照)と同じように抽出します。もう1つの停止条件はスペース文字です。

ですから、次のようにコードを変更するかどう:

int x; 
char c; 
int f; 
std::string s = "3.7"; 

std::istringstream is(s); 
is >> x; 
is >> c; 
is >> f; 

std::cout << x << std::endl; 
std::cout << c << std::endl; 
std::cout << f << std::endl; 

これは、次の出力のような結果になります。(」7" )を

3 
. 
7 
+0

私の答えがあなたを助けてくれたら、それを正しい答えとするのがいいでしょう。 –

関連する問題