Dalam membuat sebuah Program tidak harus tersu dengan bahasa Borland C++ , namun dapat juga dengan Batch File Programming. Kali ini , kita akan membuat Program Mencari Nilai Suatu Matrix Dengan Batch File Programming !
Didalam program Matrix ini terdapat 4 menu yaitu :
1.Mencari Nilai Perkalian Matrix ordo 2x2
2.Mencari Nilai Perkalian Matrix ordo 3x3
3.Mencari Determinan Matrix ordo 2x2
4.Mencari Determinan Matrix ordo 3x3
Berikut Programnya :
@ECHO OFF
title Matrix Dan Ruang Vektor [[--++--www.gudangmateri.com--++--]]
color 0a
:home
echo ======================
echo = Daftar Menu Matrix =
echo ======================
echo.
echo (1).Perkalian Matrix ordo 2 x 2
echo.
echo (2).Perkalian Matrix ordo 3 x 3
echo.
echo ===============================
echo.
echo (3).Mencari Determinan ordo 2 x 2
echo.
echo (4).Mencari Determinan ordo 3 x 3
echo.
set /p a= :masukkan angka :
cls
if %a%==1 goto:2
if %a%==2 goto:3
if %a%==3 goto:det2
if %a%==4 goto:det3
if not exist %a% goto:home
pause>nul
cls
:2
echo Mencari Matrix Dengan Ordo 2 x 2
echo.
echo [a] [b]
echo -------------------------
echo I a1 a2 I I c1 c2 I
echo I b1 b2 I I d1 d2 I
echo -------------------------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p b1= :b1 :
set /p b2= :b2 :
echo.
echo Matrix [b]
echo.
set /p c1= :c1 :
set /p c2= :c2 :
set /p d1= :d1 :
set /p d2= :d2 :
echo.
echo.
echo Tekan ENTER
echo.
echo [a] [b]
echo ----------------------------------
echo I %a1% %a2% I I %c1% %c2% I
echo I %b1% %b2% I I %d1% %d2% I
echo ----------------------------------
pause>nul
echo.
echo (%a1% x %c1%) + (%a2% x %d1%) (%a1% x %c2%) + (%a2% x %d2%)
echo (%b1% x %c1%) + (%b2% x %d1%) (%b1% x %c2%) + (%b2% x %d2%)
echo.
pause>nul
set /a e=(a1*c1)+(a2*d1)
set /a f=(a1*c2)+(a2*d2)
set /a g=(b1*c1)+(b2*d1)
set /a h=(b1*c2)+(b2*d2)
echo.
echo.
echo I %e% %f% I
echo I %g% %h% I
pause>nul
cls
goto:home
goto:2
pause>nul
:3
echo Mencari Matrix Dengan Ordo 3 x 3
echo.
echo [a] [b]
echo -------------------------------
echo I a1 a2 a3 I I d1 d2 d3 I
echo I b1 b2 b3 I I e1 e2 e3 I
echo I c1 c2 c3 I I f1 f2 f3 I
echo -------------------------------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p a3= :a3 :
set /p b1= :b1 :
set /p b2= :b2 :
set /p b3= :b3 :
set /p c1= :c1 :
set /p c2= :c2 :
set /p c3= :c3 :
echo.
echo Matrix [b]
echo.
set /p d1= :d1 :
set /p d2= :d2 :
set /p d3= :d3 :
set /p e1= :e2 :
set /p e2= :e2 :
set /p e3= :e3 :
set /p f1= :f1 :
set /p f2= :f2 :
set /p f3= :f3 :
echo.
echo.
echo Tekan ENTER
echo.
echo [a] [b]
echo ----------------------------------
echo I %a1% %a2% %a3% I I %d1% %d2% %d3% I
echo I %b1% %b2% %b3% I I %e1% %e2% %e3% I
echo I %c1% %c2% %c3% I I %f1% %f2% %f3% I
echo ----------------------------------
pause>nul
echo.
echo (%a1% x %d1% ) + (%a2% x %e1%) + (%a3% x %f1%) (%a1% x %d2%) + (%a2% x %e2%) + (%a3% x %f2%) (%a1% x %d3%) + (%a2% x %e3%) + (%a3% x %f3%)
echo (%b1% x %d1%) + (%b2% x %e1%) + (%b3% x %f1%) (%b1% x %d2%) + (%b2% x %e2%) + (%b3% x %f2%) (%b1% x %d3%) + (%b2% x %e3%) + (%b3% x %f3%)
echo (%c1% x %d1%) + (%c2% x %e1%) + (%c3% x %f1%) (%c1% x %d2%) + (%c2% x %e2%) + (%c3% x %f2%) (%c1% x %d3%) + (%c2% x %e3%) + (%c3% x %f3%)
echo.
pause>nul
set /a b1k1=(a1*d1) + (a2*e1) + (a3*f1)
set /a b2k1=(b1*d1) + (b2*e1) + (b3*f1)
set /a b3k1=(c1*d1) + (c2*e1) + (c3*f1)
set /a b1k2=(a1*d2) + (a2*e2) + (a3*f2)
set /a b2k2=(b1*d2) + (b2*e2) + (b3*f2)
set /a b3k2=(c1*d2) + (c2*e2) + (c3*f2)
set /a b1k3=(a1*d3) + (a2*e3) + (a3*f3)
set /a b2k3=(b1*d3) + (b2*e3) + (b3*f3)
set /a b3k3=(c1*d3) + (c2*e3) + (c3*f3)
echo.
echo Hasil Adalah :
echo.
echo I %b1k1% %b1k2% %b1k3% I
echo I %b2k1% %b2k2% %b2k3% I
echo I %b3k1% %b3k2% %b3k3% I
pause>nul
cls
goto:home
goto:3
pause>nul
:det2
echo Mencari determinan Matrix Dengan Ordo 2 x 2
echo.
echo [a]
echo -----------
echo I a1 a2 I
echo I b1 b2 I
echo -----------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p b1= :b1 :
set /p b2= :b2 :
echo.
echo -----------
echo I a1 a2 I
echo I b1 b2 I
echo -----------
pause>nul
echo.
echo Maka :
echo.
echo ( %a1% x %b2% ) - ( %a2% x %b1% )
echo.
pause>nul
set /a a=(a1*b2)
set /a b=(a2*b1)
set /a c=a - b
echo.
echo Determinannya Adalah %a% - %b% = %c%
pause>nul
cls
goto:home
goto:det2
pause>nul
:det3
echo Mencari determinan Matrix Dengan Ordo 3 x 3
echo.
echo [a]
echo --------------
echo I a1 a2 a3 I
echo I b1 b2 b3 I
echo I c1 c2 c3 I
echo --------------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p a3= :a3 :
set /p b1= :b1 :
set /p b2= :b2 :
set /p b3= :b3 :
set /p c1= :c1 :
set /p c2= :c2 :
set /p c3= :c3 :
echo.
echo -------------------------------------
echo I %a1% %a2% %a3% I %a1% %a2% I
echo I %b1% %b2% %b3% I %b1% %b2% I
echo I %c1% %c2% %c3% I %c1% %c2% I
echo -------------------------------------
pause>nul
echo.
echo Maka :
echo.
echo ( %a1% x %b2% x %c3% ) + ( %a2% x %b3% x %c1% ) + ( %a3% x %b1% x %c2% ) - ( %a2% x %b1% x %c3% ) + ( %a1% x %b3% x %c2% ) + ( %a3% x %b2% x %c1% )
echo.
pause>nul
set /a a=(a1*b2*c3) + (a2*b3*c1) + (a3*b1*c2)
set /a b=(a2*b1*c3) + (a1*b3*c2) + (a3*b2*c1)
set /a c=a - b
echo.
echo Determinannya Adalah %a% - %b% = %c%
pause>nul
cls
goto:home
goto:det3
goto:home
Kontributor :
Muhammad Chandra
Baca Selengkapnya ..
Didalam program Matrix ini terdapat 4 menu yaitu :
1.Mencari Nilai Perkalian Matrix ordo 2x2
2.Mencari Nilai Perkalian Matrix ordo 3x3
3.Mencari Determinan Matrix ordo 2x2
4.Mencari Determinan Matrix ordo 3x3
Berikut Programnya :
@ECHO OFF
title Matrix Dan Ruang Vektor [[--++--www.gudangmateri.com--++--]]
color 0a
:home
echo ======================
echo = Daftar Menu Matrix =
echo ======================
echo.
echo (1).Perkalian Matrix ordo 2 x 2
echo.
echo (2).Perkalian Matrix ordo 3 x 3
echo.
echo ===============================
echo.
echo (3).Mencari Determinan ordo 2 x 2
echo.
echo (4).Mencari Determinan ordo 3 x 3
echo.
set /p a= :masukkan angka :
cls
if %a%==1 goto:2
if %a%==2 goto:3
if %a%==3 goto:det2
if %a%==4 goto:det3
if not exist %a% goto:home
pause>nul
cls
:2
echo Mencari Matrix Dengan Ordo 2 x 2
echo.
echo [a] [b]
echo -------------------------
echo I a1 a2 I I c1 c2 I
echo I b1 b2 I I d1 d2 I
echo -------------------------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p b1= :b1 :
set /p b2= :b2 :
echo.
echo Matrix [b]
echo.
set /p c1= :c1 :
set /p c2= :c2 :
set /p d1= :d1 :
set /p d2= :d2 :
echo.
echo.
echo Tekan ENTER
echo.
echo [a] [b]
echo ----------------------------------
echo I %a1% %a2% I I %c1% %c2% I
echo I %b1% %b2% I I %d1% %d2% I
echo ----------------------------------
pause>nul
echo.
echo (%a1% x %c1%) + (%a2% x %d1%) (%a1% x %c2%) + (%a2% x %d2%)
echo (%b1% x %c1%) + (%b2% x %d1%) (%b1% x %c2%) + (%b2% x %d2%)
echo.
pause>nul
set /a e=(a1*c1)+(a2*d1)
set /a f=(a1*c2)+(a2*d2)
set /a g=(b1*c1)+(b2*d1)
set /a h=(b1*c2)+(b2*d2)
echo.
echo.
echo I %e% %f% I
echo I %g% %h% I
pause>nul
cls
goto:home
goto:2
pause>nul
:3
echo Mencari Matrix Dengan Ordo 3 x 3
echo.
echo [a] [b]
echo -------------------------------
echo I a1 a2 a3 I I d1 d2 d3 I
echo I b1 b2 b3 I I e1 e2 e3 I
echo I c1 c2 c3 I I f1 f2 f3 I
echo -------------------------------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p a3= :a3 :
set /p b1= :b1 :
set /p b2= :b2 :
set /p b3= :b3 :
set /p c1= :c1 :
set /p c2= :c2 :
set /p c3= :c3 :
echo.
echo Matrix [b]
echo.
set /p d1= :d1 :
set /p d2= :d2 :
set /p d3= :d3 :
set /p e1= :e2 :
set /p e2= :e2 :
set /p e3= :e3 :
set /p f1= :f1 :
set /p f2= :f2 :
set /p f3= :f3 :
echo.
echo.
echo Tekan ENTER
echo.
echo [a] [b]
echo ----------------------------------
echo I %a1% %a2% %a3% I I %d1% %d2% %d3% I
echo I %b1% %b2% %b3% I I %e1% %e2% %e3% I
echo I %c1% %c2% %c3% I I %f1% %f2% %f3% I
echo ----------------------------------
pause>nul
echo.
echo (%a1% x %d1% ) + (%a2% x %e1%) + (%a3% x %f1%) (%a1% x %d2%) + (%a2% x %e2%) + (%a3% x %f2%) (%a1% x %d3%) + (%a2% x %e3%) + (%a3% x %f3%)
echo (%b1% x %d1%) + (%b2% x %e1%) + (%b3% x %f1%) (%b1% x %d2%) + (%b2% x %e2%) + (%b3% x %f2%) (%b1% x %d3%) + (%b2% x %e3%) + (%b3% x %f3%)
echo (%c1% x %d1%) + (%c2% x %e1%) + (%c3% x %f1%) (%c1% x %d2%) + (%c2% x %e2%) + (%c3% x %f2%) (%c1% x %d3%) + (%c2% x %e3%) + (%c3% x %f3%)
echo.
pause>nul
set /a b1k1=(a1*d1) + (a2*e1) + (a3*f1)
set /a b2k1=(b1*d1) + (b2*e1) + (b3*f1)
set /a b3k1=(c1*d1) + (c2*e1) + (c3*f1)
set /a b1k2=(a1*d2) + (a2*e2) + (a3*f2)
set /a b2k2=(b1*d2) + (b2*e2) + (b3*f2)
set /a b3k2=(c1*d2) + (c2*e2) + (c3*f2)
set /a b1k3=(a1*d3) + (a2*e3) + (a3*f3)
set /a b2k3=(b1*d3) + (b2*e3) + (b3*f3)
set /a b3k3=(c1*d3) + (c2*e3) + (c3*f3)
echo.
echo Hasil Adalah :
echo.
echo I %b1k1% %b1k2% %b1k3% I
echo I %b2k1% %b2k2% %b2k3% I
echo I %b3k1% %b3k2% %b3k3% I
pause>nul
cls
goto:home
goto:3
pause>nul
:det2
echo Mencari determinan Matrix Dengan Ordo 2 x 2
echo.
echo [a]
echo -----------
echo I a1 a2 I
echo I b1 b2 I
echo -----------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p b1= :b1 :
set /p b2= :b2 :
echo.
echo -----------
echo I a1 a2 I
echo I b1 b2 I
echo -----------
pause>nul
echo.
echo Maka :
echo.
echo ( %a1% x %b2% ) - ( %a2% x %b1% )
echo.
pause>nul
set /a a=(a1*b2)
set /a b=(a2*b1)
set /a c=a - b
echo.
echo Determinannya Adalah %a% - %b% = %c%
pause>nul
cls
goto:home
goto:det2
pause>nul
:det3
echo Mencari determinan Matrix Dengan Ordo 3 x 3
echo.
echo [a]
echo --------------
echo I a1 a2 a3 I
echo I b1 b2 b3 I
echo I c1 c2 c3 I
echo --------------
echo.
pause>nul
echo. Matrix [a]
echo.
set /p a1= :a1 :
set /p a2= :a2 :
set /p a3= :a3 :
set /p b1= :b1 :
set /p b2= :b2 :
set /p b3= :b3 :
set /p c1= :c1 :
set /p c2= :c2 :
set /p c3= :c3 :
echo.
echo -------------------------------------
echo I %a1% %a2% %a3% I %a1% %a2% I
echo I %b1% %b2% %b3% I %b1% %b2% I
echo I %c1% %c2% %c3% I %c1% %c2% I
echo -------------------------------------
pause>nul
echo.
echo Maka :
echo.
echo ( %a1% x %b2% x %c3% ) + ( %a2% x %b3% x %c1% ) + ( %a3% x %b1% x %c2% ) - ( %a2% x %b1% x %c3% ) + ( %a1% x %b3% x %c2% ) + ( %a3% x %b2% x %c1% )
echo.
pause>nul
set /a a=(a1*b2*c3) + (a2*b3*c1) + (a3*b1*c2)
set /a b=(a2*b1*c3) + (a1*b3*c2) + (a3*b2*c1)
set /a c=a - b
echo.
echo Determinannya Adalah %a% - %b% = %c%
pause>nul
cls
goto:home
goto:det3
goto:home
Kontributor :
Muhammad Chandra