LAPORAN PRAKTIKUM ARRAY
Disusn Oleh :
Riski Yoga Kusumadya
201101019
Dosen :
Yosef Murya Kusuma Ardhana, S.T
JURUSAN SISTEM INFORMASI
SEKOLAH TINGGI ILMU KOMPUTER (STIKom)
"YOS SUDARSO"
PURWOKERTO
2012
Tugas Membuat Array Dua Dimensi
Listing Program tugas pertama :
// Name : aray1.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
int main() {
int huruf_A[8][41]=
{
{1,1,1,1,1,1,1,1, 0,1,1,1,1,1,1,1, 0,1,1,1,1,1,1,1, 0,1,1,0,0,0,0,1,1, 0,1,1,1,1,1,1,1},
{1,1,0,0,0,0,1,1, 0,0,0,0,1,1,0,0, 0,1,1,0,0,0,0,1, 0,1,1,1,0,0,1,1,0, 0,0,0,0,1,1,0,0},
{1,1,0,0,0,0,1,1, 0,0,0,0,1,1,0,0, 0,1,1,0,0,0,0,0, 0,1,1,0,0,1,1,0,0, 0,0,0,0,1,1,0,0},
{1,1,1,1,1,1,1,0, 0,0,0,0,1,1,0,0, 0,1,1,1,1,1,1,1, 0,1,1,0,1,1,0,0,0, 0,0,0,0,1,1,0,0},
{1,1,0,0,1,1,0,0, 0,0,0,0,1,1,0,0, 0,1,1,1,1,1,1,1, 0,1,1,1,1,0,0,0,0, 0,0,0,0,1,1,0,0},
{1,1,1,0,0,1,1,0, 0,0,0,0,1,1,0,0, 0,0,0,0,0,0,1,1, 0,1,1,0,1,1,0,0,0, 0,0,0,0,1,1,0,0},
{1,1,0,0,0,1,1,0, 0,0,0,0,1,1,0,0, 0,1,1,0,0,0,1,1, 0,1,1,0,0,1,1,0,0, 0,0,0,0,1,1,0,0},
{1,1,0,0,0,0,1,1, 0,1,1,1,1,1,1,1, 0,1,1,1,1,1,1,1, 0,1,1,0,0,0,0,1,1, 0,1,1,1,1,1,1,1},
};
int i,j;
for (i=0;i<8;i++)
{
for (j=0;j<41;j++)
if (huruf_A[i][j]==1)
cout<<"*";
else
cout<<"\x20";
cout<<endl;
}
return 0;
}
Output program :
Listing Program kedua :
//============================================================================
// Name : tugas_aray2.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
int main ()
{
int huruf[5][9][9]={
{
{1,1,1,1,1,1,1,1},
{1,1,0,0,0,0,1,1},
{1,1,0,0,0,0,1,1},
{1,1,1,1,1,1,1,0},
{1,1,0,0,1,1,0,0},
{1,1,1,0,0,1,1,0},
{1,1,0,0,0,1,1,0},
{1,1,0,0,0,0,1,1}
},
{{0,1,1,1,1,1,1,1},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,1,1,1,1,1,1,1}
},
{{0,1,1,1,1,1,1,1},
{0,1,1,0,0,0,0,1},
{0,1,1,0,0,0,0,0},
{0,1,1,1,1,1,1,1},
{0,1,1,1,1,1,1,1},
{0,0,0,0,0,0,1,1},
{0,1,1,0,0,0,1,1},
{0,1,1,1,1,1,1,1}
},
{{0,1,1,0,0,0,1,1},
{0,1,1,0,0,1,1,0},
{0,1,1,0,1,1,0,0},
{0,1,1,1,1,0,0,0},
{0,1,1,1,1,0,0,0},
{0,1,1,0,1,1,0,0},
{0,1,1,0,0,1,1,0},
{0,1,1,0,0,0,1,1}
},
{{0,1,1,1,1,1,1,1},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,0,0}
}
};
int i,j,k;
for (i=0;i<5;i++)
{
for (j=0;j<8;j++)
{
for(k=0;k<8;k++)
if(huruf[i][j][k]==1)
cout<<"*";
else
cout<<"\x20";
cout<<endl;
}
cout<<endl;
}
return 0;
}
Outpu program :
Tidak ada komentar:
Posting Komentar