Breaking News

Sunday, 13 December 2015

Array Dinamis

#include <iostream.h>
#include <conio.h>
#include <iomanip.h>

//Array Dinamis
void main()
{
int i, j, b, k;

cout<<"baris : ";
cin>>b;
cout<<"kolom : ";
cin>>k;
int **sop;
sop=new int *[b];
for(i=0;i<b;i++){
 sop[i]=new int [k];
}
for(i=0;i<b;i++)
{
for(j=0;j<k;j++)
{
cout<<"baris "<<i<<" kolom "<<j<<" : ";
cin>>sop[i][j];
}
}

for(i=0;i<b;i++)
{
for(j=0;j<k;j++)
{
cout<<sop[i][j]<<setw(4);}
cout<<endl;}
getch();

}

No comments:

Post a Comment

Designed By Fakhri Akbar