【問題描述】
輸入支票代碼(正整數)和支票金額(浮點數);按格式要求輸出:支票代碼佔8位,不足8位,則補充前導符‘0’;支票金額保留兩位小數 。
【樣例輸入】
123456 123.1
【樣例輸出】
00123456
123.10
【樣例說明】
相關知識點:浮點數輸出時的精度,寬度和填充字符。
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
int a;
float b;
cin>>a>>b;
cout<<setfill('0')<<setw(8)<<right<<a<<endl;
cout<<right<<setiosflags(ios::fixed)<<setprecision(2)<<setfill('0')<<b;
return 0;
}