题解 | #多组_A+B_EOF形式#
多组_A+B_EOF形式
https://www.nowcoder.com/practice/295063bf1bce4c2e819a8f18a5efcd20
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b;
    while(scanf("%d %d",&a,&b) != EOF)
    {
        printf("%d\n",a + b);
    }
    
    return 0;
}
  #include <iostream>
using namespace std;
int main() {
    int a, b;
    
    // 读取直到文件末尾
    while (cin >> a >> b) {
        // 计算并输出结果
        cout << a + b << endl;
    }
    
    return 0;
}
  #include <iostream>
#include <sstream>
using namespace std;
int main() {
    string line;
    
    // 逐行读取直到文件末尾
    while (getline(cin, line)) {
        s
 
剩余60%内容,订阅专栏后可继续查看/也可单篇购买
小白专属-牛客题解 文章被收录于专栏
 专注于牛客平台编程题题解,文字+图解。内容很细,小白友好系列