- 정수 10개의 합
- 똑똑안녕하세요/C++ programming
- 2010. 5. 12. 14:58
Q. 사용자로부터 총 10개의 정수를 입력받아서 그 합을출력하는 프로그램을 작성해 보자.
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int result = 0;
for (int i=1; i<11; i++)
{
int a;
cout << i << "번째 정수를 입력하세요 : " << endl;
cin >> a;
result+= a;
}
cout << result << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
'똑똑안녕하세요 > C++ programming' 카테고리의 다른 글
오버로딩 / swap 함수 구현 (0) | 2010.05.12 |
---|---|
입력된 숫자 구구단 출력 (0) | 2010.05.12 |
이름 전화번호 배열에 저장 출력 (0) | 2010.05.12 |
cout (출력) (0) | 2010.04.27 |
OOP project 1 (0) | 2010.04.27 |