#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;
void DisplayNumbers(char *Nbr[], int r, int c);
int main()
{
system("COLOR F0");
char number[2][5] = { { 'a', 'b', 'c', 'd', 'e' },{ 'f', 'g', 'h', 'i', 'j' } };
char *pNumbers[2];
*pNumbers = number[0];
for(int i = 0; i<6; i++)
(*pNumbers)[i] = number[0][i];
*(pNumbers+1) = number[1];
for(int i = 0; i<6; i++)
(*(pNumbers+1))[i] = number[1][i];
cout<<" PROGRAM POINTER DENGAN ARRAY DUA DIMENSI"<<endl;
cout<<"Daftar Huruf"<<endl;
DisplayNumbers(pNumbers, 2, 5);
return 0;
}
void DisplayNumbers(char *nbr[], int rows, int columns)
{
for(int i = 0; i<rows; i++)
for(int j = 0; j<columns; j++)
cout<<"Indeks ke - ["<<i<<"]["<<j<<"]:"<<(*(nbr+i))[j];
}
Tidak ada komentar:
Posting Komentar