setw cout

#include<iostream>
#include<iomanip>
using namespace std;
int main(){
	double a;
	cin>>a;
	cout<<fixed<<setprecision(2)<<a<<endl;
	return 0;
}
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
	int a=13,b=15;
	char c;
	cin>>a>>b>>c;
	cout<<setw(38)<<a<<endl;
	cout<<setw(37)<<c<<b<<endl;
	cout<<setw(41)<<"--------"<<endl;
	if(c=='+'){
		cout<<setw(38)<<a+b<<endl;
	}else{
		cout<<setw(38)<<a-b<<endl;
	}
	
}

  

posted @ 2024-01-29 14:53  陈若麟  阅读(7)  评论(0编辑  收藏  举报