#include <iostream>
using namespace std;
int plus5(int num_a, int num_b)
{
int sum = num_a + num_b;
return sum;
}
int main()
{
while (1)
{
int x, y;
cin >> x >> y;
cout << "x + y의 값은 " << plus5(x, y) << "입니다." << endl;
}
return 0;
}
while(1) 또는 while(true)를 이용해 무한정으로 cin을 통해 값을 넣고 결과를 도출할 수 있다.
'Computer Science > C++' 카테고리의 다른 글
C++ -5- 홀수 짝수 판별 프로그램 (0) | 2021.04.07 |
---|---|
C++ -3- 함수와의 첫 만남 (0) | 2021.04.05 |
C++ -2- 입출력 스트림과의 첫 만남 (0) | 2021.04.05 |
C++ -1- 변수와의 첫 만남 (0) | 2021.04.04 |
C++ -0- Visual Studio 2019를 사용해 Hello World 출력 (0) | 2021.04.03 |
댓글