//竖版的时候注意看题目的横线-------,刚好是7位,且右边对齐。 #include<bits/stdc++.h> using namespace std; #define int long long #define endl '\n' void solve(){ int a,b; cin>>a>>b; cout<<a<<"+"<<b<<"="<<a+b<<endl; cout<<right<<setw(7)<<a<<endl;//right是右对齐,setw(7)是宽度7位,不足在前面补空格 cout<<"+"<<right<<setw(6)<<b<<endl;//这里前面多了一个加号,所以是6位了 cout<<"-------"<<endl; cout<<right<<setw(7)<<a+b<<endl; } signed main(){ std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); solve(); return 0; }