TUGAS
BAHASA PEMROGRAMAN
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
void main()
{
char nama[29],NIM[20],lagi;
int **XY;
int baris,kolom;
clrscr();
cout<<"\t<<<<<TUGAS V BAHASA
PEMROGRAMAN>>>>>\n"<<endl;
cout<<"\t TEKNIK
ELEKTRO 2011/2012\n"<<endl;
cout<<"NAMA :
WAESAL KARNI"<<endl;
cout<<"NIM :
F1B 011 088"<<endl;
cout<<"===============================================================\n\n";
cout<<"BERIKUT ADALAH PROGRAM
TRANSPOSE MATRIKS UKURAN M x N"<<endl;
cout<<"SEBELUM MELANJUTKAN, ISIKAN
NAMA dan NIM ANDA TERLEBIH DAHULU\n\n";
cout<<"NAMA :
";
gets(nama);
cout<<"NIM :
";
cin>>NIM;
cout<<"\nTERIMA KASIH ATAS KERJASAMA SAUDARA/i"<<nama<<"...";
cout<<"\n\n\t\t\tPRESS ANY KEY TO CONTINUE...";
getch();
atas:
clrscr();
cout<<"\t==========================================================="<<endl;
cout<<"\t|SELAMAT DATANG DI PROGRAM TRANSPOSE MATRIKS UKURAN
M x N|"<<endl;
cout<<"\t| MOHON UNTUK
MENGIKUTI INSTRUKSI-INSTRUKSI YANG ADA
|"<<endl;
cout<<"\t==========================================================="<<endl;
cout<<"Masukkan jumlah baris matriks\t : ";
cin>>baris;
cout<<"Masukkan jumlah kolom matriks\t : ";
cin>>kolom;
cout<<endl;
XY=new
int *[baris];
for(int
M=0; M<baris; M++)
XY[M]=new
int [kolom];
cout<<endl;
{
for(int M=0; M<baris; M++)
{
for(int N=0; N<kolom; N++)
{
cout<<"matriks =
["<<M<<"]["<<N<<"] = ";
cin>>XY[M][N];
}
}
clrscr();
cout<<"================================================="<<endl;
cout<<"|\t\tBENTUK MATRIKS X\t\t|"<<endl;
cout<<"================================================="<<endl;
cout<<"\nNilai matrik X adalah : \n\n\n";
for(int M=0; M<baris; M++)
{
for(int
N=0; N<kolom; N++)
{
cout<<setw(10) << XY[M][N];
}
cout<<endl;
}
cout<<"\n\n";
cout<<"Hasil Transpose matrik X adalah : \n\n\n";
for(int M=0; M<kolom; M++)
{
for(int N=0; N<baris; N++)
{
cout<<setw(10)<<XY[N][M];
}
cout<<endl;
}
cout<<setw(10) << "\n\nApakah Saudara/i
"<<nama
<<" ingin mencoba lagi ?[Y/T]= ";
cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
cout<<"\n\n\n\t\tTERIMA KASIH TELAH MENCOBA PROGRAM
TRANSPORSE MATRIKS"<<endl;
cout<<"\n\t\tPRESS ANY KEY TO CLOSE";
}
getch();
0 komentar:
Posting Komentar