をフォーマットしInt
て先頭にゼロを付けて数値を表示することはできますInt
が、ゼロを付けてを に保存する方法がわかりませんstring
。
理由: "..0001" "..0002" ... "..0059"
etcで終わる画像ファイルを読み込んでいます。
私はこれを持っていますが、動作しません:
int a;
for(int i = 1; i < imgArraySize + 1; i++)
{
cout << setw(4) << setfill('0') << i << '\n';
cin >> a;
string aValue = to_string(a);
imageNames.push_back(string("test_images" + aValue + ".jpg"));
}