U E D R , A S I H C RSS

데블스캠프2006/화요일/pointer/문제3/이장길

~cpp

#include <iostream>
using namespace std;

void main()
{
	int *num1 = new int[5] ;
	int *num2 = new int[5] ;
	int *result = new int[5];
	int i,j;

	cout << "8개를 입력해 주세요.";

	for(i=0;i<4;i++){
		cin >> num1[i];
	}
	for(i=0;i<4;i++){
		cin >> num2[i];
	}

		
	for(i=0; i<5; i++){
		result[i] = num1[i] + num2[i];
	}
	

	for(i=0; i<4 ; i++){
		cout << num1[i];
	}
	cout <<endl;

	for(i=0; i<4 ; i++){
		cout << num2[i];
	}
	cout <<endl;

	for(i=0; i<4 ; i++){
		cout << result[i] ;
	}
	cout <<endl;

	
	delete [] num1;
	delete [] num2;
	delete [] result;
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:06
Processing time 0.0079 sec