#include<iostream>
#include<string>
using namespace std;
int main(){
int a, b;
while(cin>>a>>b && !(a == 0 && b == 0)){
cout<<a + b<<endl;
}
}
本文介绍了一个使用C++编写的简单加法计算器程序。该程序通过标准输入接收两个整数,并输出它们的和,直到接收到两个0为止。本文适用于初学者了解C++的基本语法及循环结构。
#include<iostream>
#include<string>
using namespace std;
int main(){
int a, b;
while(cin>>a>>b && !(a == 0 && b == 0)){
cout<<a + b<<endl;
}
}
316

被折叠的 条评论
为什么被折叠?