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;
}

 

posted @ 2017-09-28 12:04  淇洹  阅读(120)  评论(0编辑  收藏  举报