小学生趣味C++编程第8课 竖式计算

#include<iostream>
#include<iomanip>  //为了使用setw()来设置域宽
using namespace std;
int  main()
{
  int  a,b,s;
  a=18;
  b=870;
  s=a+b;
  cout<<setw(10)<<a<<endl;  
  cout<<setw(4)<<'+'<<setw(6)<<b<<endl; 
  cout<<" -----------"<<endl;
  cout<<setw(10)<<s<<endl; 
  return 0;
 } 

  

猜你喜欢

转载自www.cnblogs.com/kixiaoyuan/p/12694849.html
今日推荐