是否有更好的方法来制定这个计划。添加程序正在添加a和b以获得总和。我正在寻找改善的方法。
#include <iostream>
using namespace std;
int a = 0;
int b = 0;
int s = 0;
int main()
{
cout << "Type a Number: ";
cin >> a ;
cout << "Type another Number:";
cin >> b;
cout << "you sum is... ";
cout << int (s = (b + a)) << endl ;
system ("pause");
}
答案 0 :(得分:0)
#include<iostream>
using namespace std;
int main()
{
int a=0,b=0,sum=0;
cout<<"Type a and b"<<endl;
cin>>a>>b;
sum=a+b;
cout<<sum<<endl;
return 0;
}