day15(C++格式化输出数字)
C++格式化输出数字
1.引入包 #include<iostream> #include<iomanip>
2.声明stringstream ss;
3.ss<<"filename"<<fillname<<"/"<<"img_"<<std::setw(5)<<std::setfill('0')<<num<<'.jpg';
string s=ss.str();
std::setw(int integer)指定integer位的输出宽度,默认右对齐,只对其后面紧跟的输出产生作用,
std::setfill(int integer)指定 空下的空格 用integer代替
例:
filename=output/v_ApplyEyeMakeup_g01_c01
num=12
最后返回:s=output/v_ApplyEyeMakeup_g01_c01/img_00012.jpg
非学无以广才,非志无以成学! 【Magic_chao】
posted on 2018-09-24 16:16 Magic_chao 阅读(632) 评论(0) 收藏 举报
浙公网安备 33010602011771号