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.
私はC++プログラミングが初めてです。1256 や 2523 などの任意の数値を入力して、出力を 12.56 または 25.23 として読み取る方法を知りたいです。
基本的に私が欲しいのは、最後の2桁が小数点の右側に表示されることです。
float value = input / 100.0f; // C way printf("%.2f\n", value); // C++ way cout << setiosflags(ios::fixed) << setprecision(2) << value << endl;