7-6 混合類型數(shù)據(jù)格式化輸入 (5 分)
1. 題目摘自
https://pintia.cn/problem-sets/14/problems/786
2. 題目?jī)?nèi)容
本題要求編寫程序,順序讀入浮點(diǎn)數(shù)1馋嗜、整數(shù)病蛉、字符、浮點(diǎn)數(shù)2辨宠,再按照字符、整數(shù)、浮點(diǎn)數(shù)1春哨、浮點(diǎn)數(shù)2的順序輸出。
輸入格式:
輸入在一行中順序給出浮點(diǎn)數(shù)1恩伺、整數(shù)赴背、字符、浮點(diǎn)數(shù)2晶渠,其間以1個(gè)空格分隔凰荚。
輸出格式:
在一行中按照字符、整數(shù)褒脯、浮點(diǎn)數(shù)1便瑟、浮點(diǎn)數(shù)2的順序輸出,其中浮點(diǎn)數(shù)保留小數(shù)點(diǎn)后2位番川。
輸入樣例:
c 88 2.12 4.70
輸出樣例:
c 88 2.12 4.70
3. 源碼參考
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float fa, fd;
int ib;
char c;
cin >> fa >> ib >> c >> fd;
cout << c << " " << ib << " " << fa << " " << fixed << setprecision(2) << fd << endl;
return 0;
}