본문 바로가기

언어/_C프로그래밍(알고캠퍼스)

알고캠퍼스 10급 19차시 문제풀기답


10-19-1.cpp


http://pastebin.com/1D8kxwPY


#include <iostream>

#include <string>

#include <fstream>

using namespace std;


int main()

{

int a, b, c; // a, b, c  int선언


ifstream inStream; // input 변수선언

inStream.open("input.txt"); // input 파일열기


ofstream outStream; // output 변수선언

outStream.open("output.txt"); // output 파일열기


inStream >> a >> b; // input 파일의 a, b 읽기


c = a + b ;


outStream << a << " and " << b << " add up to " << c << ".";

  // output 파일에 계산된 문자열 넣기


inStream.close(); // input 닫기

outStream.close(); // output 닫기


return 0;

}


// 영남이공대학교 사이버보안과