PROGRAM MENGUNAAN FUNGCTION MATRIK ORDO BEBAS
#include <iostream.h>
#include <conio.h>
void main()
{
//Variabel-Variabel
int i, j, k, el, aa, ab, bb, jumlah, pilihan, matriks1[10][10], matriks2[10][10], hasil[10][10];
clrscr;
cout <<" Program Perhitung matrik A dan matrik B\n";
cout <<"masukkan jumlah baris matriks A : "; cin >>el;
cout <<"masukkan jumlah kolom matriks A : "; cin >>aa;
//Input matriks A
cout <<"------------------------------------------\n";
cout << "Masukkan elemen matrik A : ";
for(i = 0; i < el; i++)
{
for(j = 0; j < aa; j++)
{
gotoxy(29+j*3,5+i); cin >> matriks1[i][j];
}
}
cout <<"----------------------------------------------\n";
cout <<"1. Perkalian\n";
cout <<"2. Penjumlahan\n";
cout <<"3. Pengurangan\n";
cout <<"4. Tranpose\n";
cout <<"----------------------------------------------\n";
cout <<"Tentukan pilihan anda(1/2/3/4) : "; cin >> pilihan;
while (pilihan<1 || pilihan>4)
{
cout <<"Pilihan Yang Anda masukkan TIDAK TERSEDIA!!!\n";
cout <<"Tentukan pilihan anda(1/2/3/4) : "; cin >> pilihan;
}
if (pilihan==1)
{
clrscr;
ab=aa;
bb=el;
cout <<"Program Perkalian Matriks A ("<<el<<"X"<<aa<<") dan Matriks B ("<<ab<<"X"<<bb<<")\n";
cout <<"-------------------------------------------------\n";
//Input matriks B
cout <<"\n";
cout << "Masukkan elemen matrik B : ";
for(i = 0; i < ab; i++)
{
for(j = 0; j < bb; j++)
{
gotoxy(29+j*3,17+i+el-2);cin >> matriks2[i][j];
}
}
//Menghitung Perkalian Matriks
for(i = 0; i < el; i++)
{
for(j = 0; j < aa; j++)
{
for (k=0; k<el; k++)
{
jumlah = jumlah + matriks1[i][k] * matriks2[k][j] ;
}
hasil[i][j]=jumlah;
jumlah=0;
}
}
}
else if (pilihan==2)
{
clrscr;
ab=el;
bb=aa;
cout <<"Program Penjumlahan Matriks A ("<<el<<"X"<<aa<<") dan Matriks B ("<<ab<<"X"<<bb<<")\n";
cout <<"-------------------------------------------------\n";
//Input matriks B
cout <<"\n";
cout << "Masukkan elemen matrik B : ";
for(i = 0; i < ab; i++)
{
for(j = 0; j < bb; j++)
{
gotoxy(29+j*3,17+i+el-2);cin >> matriks2[i][j];
}
}
//Menghitung penjumlahan matriks
for(i = 0; i < el; i++)
{
for(j = 0; j < aa; j++)
{
hasil[i][j] = matriks1[i][j] + matriks2[i][j];
}
}
}
else if (pilihan==3)
{
clrscr;
ab=el;
bb=aa;
cout <<"Program Pengurangan Matriks A ("<<el<<"X"<<aa<<") dan Matriks B ("<<ab<<"X"<<bb<<")\n";
cout <<"-------------------------------------------------\n";
//Input matriks B
cout <<"\n";
cout << "Masukkan elemen matrik B : ";
for(i = 0; i < ab; i++)
{
for(j = 0; j < bb; j++)
{
gotoxy(29+j*3,17+i+el-2);cin >> matriks2[i][j];
}
}
//Menghitung pengurngan matriks
for(i = 0; i < el; i++)
{
for(j = 0; j < aa; j++)
{
hasil[i][j] = matriks1[i][j] - matriks2[i][j];
}
}
}
else
{
clrscr;
cout <<"Program Transpose Matriks A\n";
cout <<"-----------------------------------------\n";
//Menghitung penjumlahan matriks
for(i = 0; i < el; i++)
{
for(j = 0; j < aa; j++)
{
hasil[i][j] = matriks1[j][i];
}
}
}
//Output mulai dari sini
if (pilihan==1)
{
cout << "\nHasil perkalian matrik A dan matrik B : \n";
}
else if (pilihan==2)
{
cout << "\nHasil penjumlahan matrik A dan matrik B : \n";
}
else if (pilihan==3)
{
cout << "\nHasil pengurangan matrik A dan matrik B : \n";
}
else
{
cout << "\nHasil Transpose matrik A\n";
}
//Menampilkan matriks A
for(i = 0; i < el; i++)
{
for(j = 0; j < aa; j++)
{
gotoxy(5+j*4,21+i+el+aa-4);cout <<matriks1[i][j];
}
}
if (pilihan==1)
{
cout <<" (x)";
}
else if (pilihan==2)
{
cout <<" (+)";
}
else if (pilihan==3)
{
cout <<" (-)";
}
else
{
cout <<" TR";
}
if (pilihan!=4)
{
//Menampilkan matriks B
ab=aa; bb=el;
for(i = 0; i < ab; i++)
{
for(j = 0; j < bb; j++)
{
gotoxy(17+(aa-2)*4+j*4,21+i+el+ab-4); cout <<matriks2[i][j];
}
}
}
cout <<" (=)";
//Menampilkan Hasil Perkalian
for(i = 0; i < el; i++)
{
for(j = 0; j < aa; j++)
{
gotoxy(28+(aa+el-4)*4+j*4,21+i+el+aa-4);
cout << hasil[i][j];
}
}
getch();
}
outputnya
PEMROGRAMAN
Minggu, 12 Januari 2020
Senin, 06 Januari 2020
pascal, Perhitungan nilai akhir
Program penentu_nilai;
uses crt;
type
arr = array[1..4] of byte;
var
n : arr;
jawab : char;
procedure input;
var i : byte;
begin
gotoxy(3,1); write(' Perhitunga Nilai Akhir');
gotoxy(3,2); write('================================');
gotoxy(3,4); write('Nilai Presentasi : ');
gotoxy(3,5); write('Nilai TM : ');
gotoxy(3,6); write('Nilai Mid : ');
gotoxy(3,7); write('Nilai ujian akhir semester : ');
gotoxy(3,8); write('Nilai Akhir : ');
gotoxy(38,8); write('====> Grande : ');
for i := 1 to 4 do
begin
repeat
gotoxy(21,3+i);clrEol;
gotoxy(21,3+1);readln(N[i]);
until N[i] in [0..100];
end;
end;
procedure Hitung;
var
akhir : real;
grade : char;
begin
akhir :=(0.1*N[1])+(0.1*N[2])+(0.3*N[3])+(0.5*N[4]);
gotoxy(21,8); write (akhir:-5:2);
if akhir >= 85 then grade :='A' else
if akhir >=75 then grade :='B' else
if akhir >=65 then grade :='C' else
if akhir >=55 then grade :='D' else grade :='E';
gotoxy(46,8); write(grade);
end;
begin
repeat
input;
Hitung;
gotoxy(13,10); write('Mau coba lagi Y/T? : ');
repeat
gotoxy(36,10); jawab:=Upcase(readkey);
until(jawab='Y') or (jawab='T');
write(jawab);
until (jawab ='T');
end.
Ditulis : Muh Ridho Wachid S
uses crt;
type
arr = array[1..4] of byte;
var
n : arr;
jawab : char;
procedure input;
var i : byte;
begin
gotoxy(3,1); write(' Perhitunga Nilai Akhir');
gotoxy(3,2); write('================================');
gotoxy(3,4); write('Nilai Presentasi : ');
gotoxy(3,5); write('Nilai TM : ');
gotoxy(3,6); write('Nilai Mid : ');
gotoxy(3,7); write('Nilai ujian akhir semester : ');
gotoxy(3,8); write('Nilai Akhir : ');
gotoxy(38,8); write('====> Grande : ');
for i := 1 to 4 do
begin
repeat
gotoxy(21,3+i);clrEol;
gotoxy(21,3+1);readln(N[i]);
until N[i] in [0..100];
end;
end;
procedure Hitung;
var
akhir : real;
grade : char;
begin
akhir :=(0.1*N[1])+(0.1*N[2])+(0.3*N[3])+(0.5*N[4]);
gotoxy(21,8); write (akhir:-5:2);
if akhir >= 85 then grade :='A' else
if akhir >=75 then grade :='B' else
if akhir >=65 then grade :='C' else
if akhir >=55 then grade :='D' else grade :='E';
gotoxy(46,8); write(grade);
end;
begin
repeat
input;
Hitung;
gotoxy(13,10); write('Mau coba lagi Y/T? : ');
repeat
gotoxy(36,10); jawab:=Upcase(readkey);
until(jawab='Y') or (jawab='T');
write(jawab);
until (jawab ='T');
end.
Ditulis : Muh Ridho Wachid S
pemrograman pascal Deret bil prima
Program Bilprima;
uses crt;
function factor (n:LongInt) : LongInt;
var
i, temp : LongInt;
begin
temp :=0;
for i := 1 to n do
if n mod i=0 then inc(temp);
factor:=temp;
end;
var x, a, b, c, n : LongInt;
begin
clrscr;
gotoxy(30,4); writeln(' Deretan Bilangan Prima ');
gotoxy(30,5); writeln('================================');
gotoxy(3,7); writeln('Jumlah Bilangan Yang Mau Ditampilkan : ');
repeat
gotoxy(45,7); clrEol;
readln(a);
until (a>=2);
gotoxy(3,9); writeln('Deret Bilangan Prima : ');
b :=1;
x :=0;
repeat
if factor(b) = 2 then
begin
write(b,', ');
write(#8); {backspace}
inc(x);
end;
inc(b);
until(x=a);
readln;
end.
Ditulis: Muh Ridho Wachhid S
uses crt;
function factor (n:LongInt) : LongInt;
var
i, temp : LongInt;
begin
temp :=0;
for i := 1 to n do
if n mod i=0 then inc(temp);
factor:=temp;
end;
var x, a, b, c, n : LongInt;
begin
clrscr;
gotoxy(30,4); writeln(' Deretan Bilangan Prima ');
gotoxy(30,5); writeln('================================');
gotoxy(3,7); writeln('Jumlah Bilangan Yang Mau Ditampilkan : ');
repeat
gotoxy(45,7); clrEol;
readln(a);
until (a>=2);
gotoxy(3,9); writeln('Deret Bilangan Prima : ');
b :=1;
x :=0;
repeat
if factor(b) = 2 then
begin
write(b,', ');
write(#8); {backspace}
inc(x);
end;
inc(b);
until(x=a);
readln;
end.
Ditulis: Muh Ridho Wachhid S
Program C++ penerapan array untuk menghiitung suhu rata-rata
/* Program penerapan array untuk menghiitung suhu rata-rata*/
#include <iostream.h>
#include <conio.h>
const int jum_data=5;
void main()
{
float suhu [jum_data]; //array suhu
float total; //untuk menampung total suhu
clrscr;
cout << " Masukkan data suhu " <<"\n";
for (int i=0; i<jum_data; i++)
{
cout<< i+1 <<" : ";
cin>>suhu[i];
}
//Menghitung nilainrata-rata
total=0;
for (i=0; i<jum_data; i++)
total+=suhu[i]; //Tambahkan isis suhu[i] ke total
cout<< "suhu rata-rata =" <<total/jum_data <<"\n";
}
ditulis : muh ridho wachid s
#include <iostream.h>
#include <conio.h>
const int jum_data=5;
void main()
{
float suhu [jum_data]; //array suhu
float total; //untuk menampung total suhu
clrscr;
cout << " Masukkan data suhu " <<"\n";
for (int i=0; i<jum_data; i++)
{
cout<< i+1 <<" : ";
cin>>suhu[i];
}
//Menghitung nilainrata-rata
total=0;
for (i=0; i<jum_data; i++)
total+=suhu[i]; //Tambahkan isis suhu[i] ke total
cout<< "suhu rata-rata =" <<total/jum_data <<"\n";
}
ditulis : muh ridho wachid s
Kamis, 02 Januari 2020
program pengelolaan barang c++
PROGRAM PENGELOLAHAN BARANG.
disini saya membuat program pengelolahan barang demgan menggunakan bahasas pemroghraman c++,.
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int n,k,jml;
char nama[50];
long h,ga,th,dis,ba,um;
clrscr();
cout<<"\t PROGRAM PENGELOLAHAN DATA PENJUALAN BARANG \n";
cout<<"\t==============================================\n";
cout<<"Jumlah Item Barang Yang terjual = \n";
cin>>n;
um=0;
for (k=1; k<=n; k++)
{
cout<<"Item Barang yang ke = "<<k<<"\n";
cout<<"Masukkan Nama Barang = ";
cin>>nama;
cout<<"Masukkan Harga Satuan = ";
cin>>h;
cout<<"Masukkan Jumlah Barang = ";
cin>>jml;
th=h*jml;
dis=th*0.1;
ba=th-dis;
um+=ba;
cout<<"total Harga = "<<th<<"\n";
cout<<"Besar Diskon = "<<ba<<"\n";
cout<<"Jumlah Bayar = "<<um<<"\n";
cout<<"\n";
}
cout<<"\t============================================\n";
cout<<"\tJumlah Uang masuk = "<<um<<"\n";
cout<<"\t--------------------------------------------\n";
}
disini saya membuat program pengelolahan barang demgan menggunakan bahasas pemroghraman c++,.
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int n,k,jml;
char nama[50];
long h,ga,th,dis,ba,um;
clrscr();
cout<<"\t PROGRAM PENGELOLAHAN DATA PENJUALAN BARANG \n";
cout<<"\t==============================================\n";
cout<<"Jumlah Item Barang Yang terjual = \n";
cin>>n;
um=0;
for (k=1; k<=n; k++)
{
cout<<"Item Barang yang ke = "<<k<<"\n";
cout<<"Masukkan Nama Barang = ";
cin>>nama;
cout<<"Masukkan Harga Satuan = ";
cin>>h;
cout<<"Masukkan Jumlah Barang = ";
cin>>jml;
th=h*jml;
dis=th*0.1;
ba=th-dis;
um+=ba;
cout<<"total Harga = "<<th<<"\n";
cout<<"Besar Diskon = "<<ba<<"\n";
cout<<"Jumlah Bayar = "<<um<<"\n";
cout<<"\n";
}
cout<<"\t============================================\n";
cout<<"\tJumlah Uang masuk = "<<um<<"\n";
cout<<"\t--------------------------------------------\n";
}
Rabu, 25 Desember 2019
Program perhitungan nilai c++
Program perhitungan nilai
include<iostream.h>
#include <conio.h>
void main()
{
char nm_mhs[30];
float nilai;
clrscr();
cout<<"Nama mahasiwa : ";
cin>>nm_mhs;
cout<<"Nilai mahasiswa : ";
cin>>nilai;
if (nilai >70)
cout<<" lulus : \n";
else
cout<<"tidak lulus : \n";
}
include<iostream.h>
#include <conio.h>
void main()
{
char nm_mhs[30];
float nilai;
clrscr();
cout<<"Nama mahasiwa : ";
cin>>nm_mhs;
cout<<"Nilai mahasiswa : ";
cin>>nilai;
if (nilai >70)
cout<<" lulus : \n";
else
cout<<"tidak lulus : \n";
}
Program jadwal kuliah
Program jadwal kuliah
#include <iostream.h>
#include <conio.h>
using namespace std;
int main() {
int kode;
cout<<" \t JADWAL PERKULIAHAN\n";
cout<<"\t ================================\n";
cout<<"\tUNIVERSITAS RESPATI YOGYAKARTA\n";
cout<<"\t____________________________________\n";
cout<<"\tTEKNOLOGI INFORMATIKA\n";
cout<<"\t================================\n\n";
cout << "1 = SENIN 2 = SELASA 3 = RABU 4 = KAMIS" << endl;
cout << "5 = JUM'AT 6 = SABTU 7 = MINGGU" << endl;
cout << "Masukkan kode hari (1-7) = ";
cin >> kode;
switch (kode)
{
case 1:
cout<<"\tSISTEM OPRASI\n";
cout<<"\t JAM 15:00_14.40\n";
break;
case 2:
cout<<"\tPRAKTIK UTILITY\n ";
cout<<"\tJam 07.00_10:40\n";
cout<<"\tPRAKTEK PENGNTAR TEKNOLOGI\n";
cout<<"\tJam 13:00_14:40\n";
cout<<"\tPRAKTEK SISTEM OPRASI\n";
cout<<"\tJam 15:00_14:40";
break;
case 3:
cout<<"\tBAHASA INGGRIS\n";
cout<<"\tJam 07:00_08:40\n";
cout<<"\tAGAMA ISLAM\n";
cout<<"\tJam 09:00_12:40\n";
cout<<"\tLOGIKA ALGORITMA\n";
cout<<"\tJam 15:00_16:40\n";
break;
case 4:
cout<<"\tPRAKTEK PEMROGRAMAN DASAR\n";
cout<<"\tJam 09:00_12:40\n";
cout<<"\tPRAKTEK LOGIKA ALGORITMA\n";
cout<<"\tJam 15:00_16:40\n";
break;
case 5:
cout<<"\tMATEMATIKA DISTRIT\n";
cout<<"\tJam 09:00_10:40\n";
cout<<"\tPENGANTAR TEKNOLOGI\n";
cout<<"\tJam 13:00_14.40\n";
break;
case 6:
case 7:
cout<< " HOLYDAY LAH ...!! JALAN-JALAN SUPAYA OTAKMU FRESH, HATIMU TENANG .TETAP SEMANGAT !!! \n"<< endl;
break;
default:
cout << "Kode hari tidak valid" << endl;
}
return 0;
}
#include <iostream.h>
#include <conio.h>
using namespace std;
int main() {
int kode;
cout<<" \t JADWAL PERKULIAHAN\n";
cout<<"\t ================================\n";
cout<<"\tUNIVERSITAS RESPATI YOGYAKARTA\n";
cout<<"\t____________________________________\n";
cout<<"\tTEKNOLOGI INFORMATIKA\n";
cout<<"\t================================\n\n";
cout << "1 = SENIN 2 = SELASA 3 = RABU 4 = KAMIS" << endl;
cout << "5 = JUM'AT 6 = SABTU 7 = MINGGU" << endl;
cout << "Masukkan kode hari (1-7) = ";
cin >> kode;
switch (kode)
{
case 1:
cout<<"\tSISTEM OPRASI\n";
cout<<"\t JAM 15:00_14.40\n";
break;
case 2:
cout<<"\tPRAKTIK UTILITY\n ";
cout<<"\tJam 07.00_10:40\n";
cout<<"\tPRAKTEK PENGNTAR TEKNOLOGI\n";
cout<<"\tJam 13:00_14:40\n";
cout<<"\tPRAKTEK SISTEM OPRASI\n";
cout<<"\tJam 15:00_14:40";
break;
case 3:
cout<<"\tBAHASA INGGRIS\n";
cout<<"\tJam 07:00_08:40\n";
cout<<"\tAGAMA ISLAM\n";
cout<<"\tJam 09:00_12:40\n";
cout<<"\tLOGIKA ALGORITMA\n";
cout<<"\tJam 15:00_16:40\n";
break;
case 4:
cout<<"\tPRAKTEK PEMROGRAMAN DASAR\n";
cout<<"\tJam 09:00_12:40\n";
cout<<"\tPRAKTEK LOGIKA ALGORITMA\n";
cout<<"\tJam 15:00_16:40\n";
break;
case 5:
cout<<"\tMATEMATIKA DISTRIT\n";
cout<<"\tJam 09:00_10:40\n";
cout<<"\tPENGANTAR TEKNOLOGI\n";
cout<<"\tJam 13:00_14.40\n";
break;
case 6:
case 7:
cout<< " HOLYDAY LAH ...!! JALAN-JALAN SUPAYA OTAKMU FRESH, HATIMU TENANG .TETAP SEMANGAT !!! \n"<< endl;
break;
default:
cout << "Kode hari tidak valid" << endl;
}
return 0;
}
Langganan:
Postingan (Atom)