Sum the Numbers

The simplest program on the training pages: read in two integers from a single line and print their sum.

PROGRAM NAME: test

INPUT FORMAT

  • Line 1: Two small space-separated integers

SAMPLE INPUT (file test.in)

1 3

OUTPUT FORMAT

  • Line 1: A single integer that is the sum of the two input integers.

SAMPLE OUTPUT (file test.out)

4
/*
ID: hillwater
PROG: test
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{
    ofstream fout("test.out");
    ifstream fin("test.in");
    int a, b;
    fin >> a >> b;
    fout << a+b << endl;
    return 0;
}
原文地址:https://www.cnblogs.com/tanjiaqi/p/7606097.html