EXTRAS TUGAS
Kristianus Unang
201101018
Dosen:
Yosef Murya Kusuma Ardhana , S.T
Jurusan Sistem Informasi
Sekolah Tinggi Ilmu Komputer (STIKOM)
"Yos Sudarso"
Purwokerto
2012
2012
---------------------------------------------------------------------------------------------------------------------------------------
LISTING PROGRAM :
SWITCH CASE :
#include <iostream.h>
#include <conio.h>
main()
{
int a,b,c;
int d;
int two_dimention[8][45]={
{1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 0,0,0,1,1,0,0,0,0, 1,1,1,1,1,1,1,1,0, 1,1,1,1,1,1,1,1,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 0,0,1,1,1,1,0,0,0, 1,1,1,1,1,1,1,1,0, 1,1,1,1,1,1,1,1,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 0,1,1,0,0,1,1,0,0, 1,1,1,1,1,1,1,1,0, 1,1,1,0,0,0,0,0,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,0,0,0,0,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0},
{1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,0,1,1,0},
{1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0},
{1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0},
};
int three_dimention[5][8][8]={
{{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1}},
{{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1}},
{{0,0,0,1,1,0,0,0},
{0,0,1,1,1,1,0,0},
{0,1,1,0,0,1,1,0},
{1,1,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1}},
{{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1}},
{{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,0,0,0,0},
{1,1,1,1,0,1,1,1},
{1,1,1,1,0,1,1,1},
{1,1,1,1,0,0,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1}},
};
cout<<"=======================================================\n";
cout<<" Array 2 Dimention & 3 Dimention (with switch case) \n";
cout<<" by : Kristianus Unang \n";
cout<<"=======================================================\n\n";
cout<<"Choose Array to show name \n";
cout<<"* 1 = Array 2D \n";
cout<<"** 2 = Array 3D \n\n";
cout<<"Choose: ";
cin>>d;
cout<<"\n";
switch (d)
{
case 1:
for(a=0;a<8;a++)
{
for(b=0;b<45;b++)
if(two_dimention[a][b]==1)
cout<<"*";
else
cout<<"\x20";
cout<<endl;
}
break;
case 2:
for(a=0;a<5;a++)
{
for(b=0;b<8;b++)
{
for(c=0;c<8;c++)
if(three_dimention[a][b][c]==1)
cout<<"*";
else
cout<<"\x20";
cout<<endl;
}
cout<<endl;
}
break;
}
cout<<"\n\n";
cout<<"Thanks For Your Choice ^_^ \n";
getche();
}
OUTPUT PROGRAM :
Tampilan Awal |
Picture 1 |
Picture 2 |
---------------------------------------------------------------------------------------------------------------------------------------
LISTING PROGRAM :
WHILE :
#include <iostream.h>
#include <conio.h>
main()
{
int array [1];
int e,f,g;
int h;
int two_dimention[8][45]={
{1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 0,0,0,1,1,0,0,0,0, 1,1,1,1,1,1,1,1,0, 1,1,1,1,1,1,1,1,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 0,0,1,1,1,1,0,0,0, 1,1,1,1,1,1,1,1,0, 1,1,1,1,1,1,1,1,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 0,1,1,0,0,1,1,0,0, 1,1,1,1,1,1,1,1,0, 1,1,1,0,0,0,0,0,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,0,0,0,0,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0},
{1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0},
{1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,0,1,1,0},
{1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0},
{1,1,1,1,1,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,0,0,1,1,1,0, 1,1,1,1,1,1,1,1,0},
};
int three_dimention[5][8][8]={
{{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1}},
{{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1}},
{{0,0,0,1,1,0,0,0},
{0,0,1,1,1,1,0,0},
{0,1,1,0,0,1,1,0},
{1,1,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1}},
{{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1},
{1,1,1,0,0,1,1,1}},
{{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,0,0,0,0},
{1,1,1,1,0,1,1,1},
{1,1,1,1,0,1,1,1},
{1,1,1,1,0,0,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1}},
};
array[1]= two_dimention[8][45];
array[2]= three_dimention[5][8][8];
while (1)
{
cout<<"=======================================================\n";
cout<<" Array 2 Dimention & 3 Dimention (with while) \n";
cout<<" by : Kristianus Unang \n";
cout<<"=======================================================\n";
cout<<"Choose Array to show name \n";
cout<<"* 1 = Array 2D \n";
cout<<"** 2 = Array 3D \n\n";
cout<<"Choose: ";
cin>>h;
cout<<"\n";
if((h==1))
for(e=0;e<8;e++)
{
for(f=0;f<45;f++)
if(two_dimention[e][f]==1)
cout<<"*";
else
cout<<"\x20";
cout<<endl;
}
if((h==2))
for(e=0;e<5;e++)
{
for(f=0;f<8;f++)
{
for(g=0;g<8;g++)
if(three_dimention[e][f][g]==1)
cout<<"*";
else
cout<<"\x20";
cout<<endl;
}
cout<<endl;
}
else
cout<<"Make Sure Your Choice!!!\n";
break;
}
cout<<"\n";
cout<<"Thanks For Your Choice & See you ^_^\n";
getche();
}
OUTPUT PROGRAM :
Tampilan Awal |
Picture 3 |
Picture 4 |
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Tidak ada komentar:
Posting Komentar