06장_배열과%20포인터

Cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: = " << tot <<"\n"; cout << "평균 = " << avg <<"\n"; } -7- IT COOKBOOK [실습하기 6-3] 배열을 사용하여 최대값 구하기 [예제 6-3] 6_3.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #include<iostream> using namespace std; void main() { int a[5]; int max; int i; cout << "정수형 데이터를 5개 입력하라\n"; for(i=0; i<5; i++){ cout << "a[ " << i <<" ] => "; cin >> a[i]; } max = a[0]; for(i=1; i<5; i++) if(a[i] > max) max=a[i]; cout << "최대값 => " << max <<"\n"; } -8- IT COOKBOOK 2) 2차원 배열 IT COOKBOOK 2차원 배열의 개념과 선언 -9- 2) 2차원 배열 IT COOKBOOK 2차원 배열의 초기화 - 10 - [실습하기 6-4] 2차원 배열을 초기화하고 출력하기 [예제 6-4] 6_4.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 #include<iostream.h> #defin...
View Full Document

This document was uploaded on 01/19/2014.

Ask a homework question - tutors are online