#include "stdafx.h"
#include <iostream>
using namespace std;
void main(int argc, _TCHAR* argv[])
{
double iarr2[2][3] = { 10,20,30,40,50,60};
cout << "배열 포인터 활용 " << endl << endl;
cout << "**************** iarr2[i][j] " <<endl;
for(int i = 0; i <2; i ++){ // iarr2[i][j]
for(int j = 0; j < 3; j ++){
cout << "iarr2["<<i<<"]["<<j<<"] : " ;
cout << iarr2[i][j] << " ";
}
cout << endl;
}
cout <<endl << "*************** *(iarr2[i]+j) "<<endl;
for(int i = 0; i <2; i ++){ // *(iarr2[i] + j)
for(int j = 0; j < 3; j ++){
cout << "iarr2["<<i<<"]["<<j<<"] : " ;
cout << *(iarr2[i]+j) << " ";
}
cout << endl;
}
cout <<endl << "**************** *(*(iarr2 +i) +j) "<< endl;
for(int i = 0; i <2; i ++){ // *(*(iarr2 +i) +j)
for(int j = 0; j < 3; j ++){
cout << "iarr2["<<i<<"]["<<j<<"] : " ;
cout << *(*(iarr2+i)+j) << " ";
}
cout << endl;
}
int k = 0;
cout << endl << "**************** *(*(iarr2 +i) +j)" << endl;
for(int i = 0; i <1; i ++){ // iarr2[0][6]
for(int j = 0; j < 6; j ++){
cout << "iarr2["<<i<<"]["<<j<<"] : " ;
cout << iarr2[i][j] << " ";
k++;
if(k%3 == 0){
cout << endl;
}
}
}
k = 0;
cout <<endl << "**************** iarr2[1][-3] " << endl;
for(int i = 1; i <2; i ++){ // iarr2[1][-3]
for(int j = -3; j < 3; j ++){
cout << "iarr2["<<i<<"]["<<j<<"] : " ;
cout << iarr2[i][j] << " ";
k++;
if(k%3 == 0){
cout << endl;
}
}
}
}
'컴퓨터과학[1-2] > knou_C++' 카테고리의 다른 글
C ++ 연습문제 풀이 4 -1 (0) | 2014.10.21 |
---|---|
C ++ Structure & Destructure (0) | 2014.10.11 |
C ++연습문제 2-1 풀이 (0) | 2014.08.17 |
getline(), get() 을 이용한 cin 에서 행 단위 입력 (0) | 2014.08.17 |
C++ 연습문제 3-2 풀이 (0) | 2014.08.09 |
댓글