Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列 6.78 を float に変換するにはどうすればよいですか? float 7.89 を文字列に変換するにはどうすればよいですか?
これらの質問は両方とも同様の答えを持っていますか?
<string>あなたが持っている標準ライブラリで
<string>
std::string std::to_string(float val) and float std::stof (const std::string& str, size_t* idx = 0)
stofとto_stringを参照
あなたの環境は何ですか?
Visual Studio と Windows の場合は、atoi() と itoa() を使用します。