arrows blog

解いた問題などを適当に書いていきます。

memo

acos

acos(x)のxの範囲は、[-1,1]であり、 その範囲外の数値を入れると、nanとなる。

ある文字区切りで文字列を分割する方法

string str = 文字列; stringstream ss(str); while(getline(ss,部分文字列を代入するための変数,分割したい文字)){} 例えば、カンマ(',')区切りで分割したい場合 string out; string str = "abc,def,ghi,jkl"; stringstream ss(str); while(getline(ss,out,…