#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{ int nilai;
cout<<"========================================================="<<endl;
cout<<" PROGRAM KONVERSI NILAI MAHASISWA "<<endl;
cout<<"========================================================="<<endl;
cout<<"Masukkan nilai Mahasiswa : ";
cin>>nilai;
{
if (nilai >= 80 && nilai <=100){
cout<<"Nilai "<<nilai<<" = A"<<endl;
}
else if (nilai >= 65 && nilai <=79){
cout<<"Nilai "<<nilai<<" = B"<<endl;
}
else if (nilai >= 55 && nilai <=64){
cout<<"Nilai "<<nilai<<" = C"<<endl;
}
else if (nilai >= 40 && nilai <=54){
cout<<"Nilai "<<nilai<<" = D"<<endl;
}
else{
cout<<"Nilai "<<nilai<<" = E"<<endl;
}
}
system("pause");
return 0;
}
Hasil Compilenya
Selasa, 30 Juni 2015
Program Perkalian 2 Matriks Dalam C++
#include<iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Pengurangan Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] * m2[i][j];
cout << "\nHasilnya" << endl;
cout << "Matrix A x Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Hasil compilenya
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Pengurangan Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] * m2[i][j];
cout << "\nHasilnya" << endl;
cout << "Matrix A x Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Hasil compilenya
Program Pembagian 2 Matrik dalam C++
#include<iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Pembagian Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] / m2[i][j];
cout << "\nHasilnya" << endl;
cout << "Matrix A : Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Hasil Compilenya
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Pembagian Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] / m2[i][j];
cout << "\nHasilnya" << endl;
cout << "Matrix A : Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Hasil Compilenya
Program Luas Dan Keliling Lingkaran Dalam C++
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
float r, L, K, Pi;
Pi=3.14;
cout<<"====================================================="<<endl;
cout<<" Program Luas Dan Keliling Lingkaran "<<endl;
cout<<"====================================================="<<endl;
cout<<"Masukan jari-jari(r) : "; cin>>r;
L=Pi*r*r;
K=2*Pi*r;
cout<<"Luas lingkaran : "<<L<<endl;
cout<<"Keliling lingkaran : "<<K<<endl;
system("pause");
return 0;
}
Hasil Compilenya
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
float r, L, K, Pi;
Pi=3.14;
cout<<"====================================================="<<endl;
cout<<" Program Luas Dan Keliling Lingkaran "<<endl;
cout<<"====================================================="<<endl;
cout<<"Masukan jari-jari(r) : "; cin>>r;
L=Pi*r*r;
K=2*Pi*r;
cout<<"Luas lingkaran : "<<L<<endl;
cout<<"Keliling lingkaran : "<<K<<endl;
system("pause");
return 0;
}
Hasil Compilenya
Program Perulangan Dalam C++
#include <cstdlib>
#include <iostream>
using namespace std;
class perulangan{
public:
perulangan(){n=4;}
void ulang_for(int);
void ulang_while(int);
private:
int n;
};
int main(int argc, char *argv[]){
int x;
cout<<"=================================="<<endl;
cout<<" PROGRAM PERULANGAN "<<endl;
cout<<"=================================="<<endl<<endl;
cout << "Masukkan batasan : "; cin >> x;
cout << endl;
perulangan X;
cout << "Menggunakan cara iteratif" << endl;
X.ulang_for(x);
cout << "Menggunakan cara while" << endl;
X.ulang_while(x);
cout << endl;
system("pause");
return 0;
}
void perulangan::ulang_for(int n){
for (int i=1; i<=n; i++){
cout << i << " ";
}
cout << endl;
}
void perulangan::ulang_while(int n){
int i=1;
while (n>=i) {
cout << n << " ";
n--;
}
cout << endl;
}
Hasil Compilenya
#include <iostream>
using namespace std;
class perulangan{
public:
perulangan(){n=4;}
void ulang_for(int);
void ulang_while(int);
private:
int n;
};
int main(int argc, char *argv[]){
int x;
cout<<"=================================="<<endl;
cout<<" PROGRAM PERULANGAN "<<endl;
cout<<"=================================="<<endl<<endl;
cout << "Masukkan batasan : "; cin >> x;
cout << endl;
perulangan X;
cout << "Menggunakan cara iteratif" << endl;
X.ulang_for(x);
cout << "Menggunakan cara while" << endl;
X.ulang_while(x);
cout << endl;
system("pause");
return 0;
}
void perulangan::ulang_for(int n){
for (int i=1; i<=n; i++){
cout << i << " ";
}
cout << endl;
}
void perulangan::ulang_while(int n){
int i=1;
while (n>=i) {
cout << n << " ";
n--;
}
cout << endl;
}
Hasil Compilenya
Program Pencarian Huruf Dalam RAPTOR
Program Main Dengan Inputan "Algoritma" dan pencarian terhadap huruf "t"
Hasil Programnya
Program Penjumlahan 2 Matriks Dalam C++
#include<iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Penjumlahan Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] + m2[i][j];
cout << "\nHasilnya…" << endl;
cout << "Matrix A + Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Hasil Programnya
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Penjumlahan Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] + m2[i][j];
cout << "\nHasilnya…" << endl;
cout << "Matrix A + Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Hasil Programnya
Program Mesin ATM Dalam C++
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;
class ATM{
public: ATM();
void input();
bool proses();
void output();
private: int pin;
};
ATM :: ATM(){
cout<<"================SELAMAT DATANG DI BANK BRI================="<<endl;
cout<<endl<<endl;
}
void ATM::input(){
cout<<"Masukan PIN anda : ";cin>>pin;
}
bool ATM::proses(){
if (pin != 1400018211){
return false;}
else{
return true;}
}
void ATM::output(){
cout<<"Pilih Menu Transaksi :"<<endl;
cout<<"1.Tarik Tunai"<<endl;
cout<<"2.Transfer"<<endl;
cout<<"3.Pembayaran"<<endl;
cout<<"4.Info Saldo"<<endl;
cout<<"5.Lain-lain\n"<<endl;
}
int main(int argc, char *argv[])
{
ATM go;
for (int i=1;i<=3;i++){
go.input();
if (go.proses()==true){
go.output();
break;
}
else if( (go.proses()==false) and (i==3)){
cout<<"Maaf, anda sudah salah memasukkan PIN 3 kali ATM anda terblokir sementara"<<endl;
break;
}
else
cout<<"Pin yang anda masukan salah, silakan coba lagi"<<endl<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Jika Password ATM Benar
Jika Password ATM Salah
#include <iostream>
#include <conio.h>
using namespace std;
class ATM{
public: ATM();
void input();
bool proses();
void output();
private: int pin;
};
ATM :: ATM(){
cout<<"================SELAMAT DATANG DI BANK BRI================="<<endl;
cout<<endl<<endl;
}
void ATM::input(){
cout<<"Masukan PIN anda : ";cin>>pin;
}
bool ATM::proses(){
if (pin != 1400018211){
return false;}
else{
return true;}
}
void ATM::output(){
cout<<"Pilih Menu Transaksi :"<<endl;
cout<<"1.Tarik Tunai"<<endl;
cout<<"2.Transfer"<<endl;
cout<<"3.Pembayaran"<<endl;
cout<<"4.Info Saldo"<<endl;
cout<<"5.Lain-lain\n"<<endl;
}
int main(int argc, char *argv[])
{
ATM go;
for (int i=1;i<=3;i++){
go.input();
if (go.proses()==true){
go.output();
break;
}
else if( (go.proses()==false) and (i==3)){
cout<<"Maaf, anda sudah salah memasukkan PIN 3 kali ATM anda terblokir sementara"<<endl;
break;
}
else
cout<<"Pin yang anda masukan salah, silakan coba lagi"<<endl<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Jika Password ATM Benar
Jika Password ATM Salah
Program Tukar 3 Bilangan Dalam C++
#include <iostream>
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
cout<<"===========Progam Tukar 3 Nilai Bilangan==================="<<endl;
int a,b,c,d;
a=2;
b=3;
c=5;
d=a;
a=c;
c=b;
b=d;
cout<<" Nilai A : "<<a<<endl;
cout<<" Nilai B : "<<b<<endl;
cout<<" Nilai C : "<<c<<endl;
return 0;
}
Ini adalah Hasil Compile di atas
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
cout<<"===========Progam Tukar 3 Nilai Bilangan==================="<<endl;
int a,b,c,d;
a=2;
b=3;
c=5;
d=a;
a=c;
c=b;
b=d;
cout<<" Nilai A : "<<a<<endl;
cout<<" Nilai B : "<<b<<endl;
cout<<" Nilai C : "<<c<<endl;
return 0;
}
Ini adalah Hasil Compile di atas
Program Rekursif Bilangan Faktorial Dalam C++
#include <iostream>
#include <conio.h>
using namespace std;
int faktorial (int bil)
{
if(bil==1)
return 1;
else
//fungsi rekursif
return bil*faktorial(bil-1);
}
int main ()
{
int n;
cout<<"Fungsi Rekursif Faktorial"<<endl<<endl;
cout<<"Masukkan nilai n = ";
cin>>n;
cout<<"\nFaktorial "<<n<<"!= "<<faktorial(n)<<endl;
getche();
}
Ini adalah Hasil Programnya
#include <conio.h>
using namespace std;
int faktorial (int bil)
{
if(bil==1)
return 1;
else
//fungsi rekursif
return bil*faktorial(bil-1);
}
int main ()
{
int n;
cout<<"Fungsi Rekursif Faktorial"<<endl<<endl;
cout<<"Masukkan nilai n = ";
cin>>n;
cout<<"\nFaktorial "<<n<<"!= "<<faktorial(n)<<endl;
getche();
}
Ini adalah Hasil Programnya
Program Mencari Titik Tengah Dalam C++
#include <iostream>
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int A,B,x1,x2,y1,y2;
cout<<"Program Mencari Titik Tengah"<<endl<<endl;
cout<<"Masukan nilai x1 : ";
cin>>x1;
cout<<"Masukan nilai x2 : ";
cin>>x2;
cout<<"Masukan nilai y1 : ";
cin>>y1;
cout<<"Masukan nilai y2 : ";
cin>>y2;
A=((x1+y1)/2);
B=((x2+y2)/2);
cout<<"Titik tengah garisnya " << x1 << " Dan " << y1 <<endl;
cout<<" adalah = " << A <<endl<<endl;
cout<<"Titik tengah garisnya " << x2 << " Dan " << y2 <<endl;
cout<<" adalah = " << B <<endl;
return 0;
}
Dan ini Adalah hasil Ouputnya
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int A,B,x1,x2,y1,y2;
cout<<"Program Mencari Titik Tengah"<<endl<<endl;
cout<<"Masukan nilai x1 : ";
cin>>x1;
cout<<"Masukan nilai x2 : ";
cin>>x2;
cout<<"Masukan nilai y1 : ";
cin>>y1;
cout<<"Masukan nilai y2 : ";
cin>>y2;
A=((x1+y1)/2);
B=((x2+y2)/2);
cout<<"Titik tengah garisnya " << x1 << " Dan " << y1 <<endl;
cout<<" adalah = " << A <<endl<<endl;
cout<<"Titik tengah garisnya " << x2 << " Dan " << y2 <<endl;
cout<<" adalah = " << B <<endl;
return 0;
}
Dan ini Adalah hasil Ouputnya
Perkalian 2 Matriks Dalam C++
#include<iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Pengurangan Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] * m2[i][j];
cout << "\nHasilnya…" << endl;
cout << "Matrix A x Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Dan Inilah Hasil Output Programnya
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main()
{
cout << "Operasi Pengurangan Matrix\n";
do
{
cout << "Jumlah Baris = "; cin>>baris;
cout << "Jumlah Kolom = "; cin>>kolom;
}
while((baris>10)||(kolom>10));
/* do
while(kolom>10);*/
cout << "\nMatrix A" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m1[i][j];
}
cout << "\nMatrix B" << endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++)
{
cout <<"data [" << i << "," << j << "] = ";
cin>>m2[i][j];
}
for(i=0; i<baris;i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] * m2[i][j];
cout << "\nHasilnya…" << endl;
cout << "Matrix A x Matrix B = Matrix C";
for(i=0; i< baris; i++)
{
cout<<'\n';
for(j=0; j<kolom; j++)
cout << setw(4) << m1[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << m2[i][j];
cout << " ";
for(j=0; j<kolom; j++)
cout << setw(4) << hasil[i][j];
cout << endl;
}
getch();
}
Dan Inilah Hasil Output Programnya
Program Transpose Matriks C++
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
main(){
int A[10][10],b,c,baris,kolom;
char pil;
do{
cout<<" ==========PROGRAM TRANSPOSE MATRIKS========= "<<endl;
cout<<"Jumlah Baris : ";
cin>>baris;
cout<<"Jumlah Kolom : ";
cin>>kolom;
cout<<endl;
for (b=0;b<baris;b++)
{
for (c=0;c<kolom;c++)
{
cout<<"Matriks ["<<b+1<<","<<c+1<<"] = ";
cin>>A[b][c];
}
}
cout<<endl<<endl;
cout<<"Matriks Pertama : "<<endl<<endl;
for (b=0;b<baris;b++)
{
for (c=0;c<kolom;c++)
{
cout<<" "<<A[b][c]<<" ";
}
cout<<endl<<endl;
}
cout<<" Matriks Transpose : "<<endl<<endl;
for (b=0;b<kolom;b++)
{
for (c=0;c<baris;c++)
{
cout<<" "<<A[c][b]<<" ";
}
cout<<endl;
cout<<endl;
}
getch();
cout<<" Ingin Mengulang Program ? (Y/N) : ";
cin>>pil;
}
while(pil=='Y'||pil=='y');
}
Dan Inilah Hasil Output Programnya
#include<conio.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
main(){
int A[10][10],b,c,baris,kolom;
char pil;
do{
cout<<" ==========PROGRAM TRANSPOSE MATRIKS========= "<<endl;
cout<<"Jumlah Baris : ";
cin>>baris;
cout<<"Jumlah Kolom : ";
cin>>kolom;
cout<<endl;
for (b=0;b<baris;b++)
{
for (c=0;c<kolom;c++)
{
cout<<"Matriks ["<<b+1<<","<<c+1<<"] = ";
cin>>A[b][c];
}
}
cout<<endl<<endl;
cout<<"Matriks Pertama : "<<endl<<endl;
for (b=0;b<baris;b++)
{
for (c=0;c<kolom;c++)
{
cout<<" "<<A[b][c]<<" ";
}
cout<<endl<<endl;
}
cout<<" Matriks Transpose : "<<endl<<endl;
for (b=0;b<kolom;b++)
{
for (c=0;c<baris;c++)
{
cout<<" "<<A[c][b]<<" ";
}
cout<<endl;
cout<<endl;
}
getch();
cout<<" Ingin Mengulang Program ? (Y/N) : ";
cin>>pil;
}
while(pil=='Y'||pil=='y');
}
Dan Inilah Hasil Output Programnya
Langganan:
Postingan (Atom)
PEMROGRAMAN WEB DINAMIS 2
MEMBUAT FORM INPUT DATA KELUARAGA SOURCODE Bagian pertama buatlah file php dengan nama Index.php dan buat lagi file tempat menyimpan isi ...
-
#include<iostream> #include <conio.h> #include <iomanip> using namespace std; int i, j, baris, kolom, m1[10][10], m2[10][1...
-
#include <cstdlib> #include <iostream> #include <conio.h> using namespace std; class ATM{ public: ATM(); ...