Sabtu, 23 Desember 2017

Restaurant

Membuat Aplikasi Restaurat

1. Bagian Admin

form login ( menggunakan session )

<?php session_start();
error_reporting(0);
if(isset($_SESSION['id_admin'])){

?>
<script language="javascript">document.location.href='dashboard.php'</script>
<?php
}
else if(isset($_SESSION['id_kasir'])){
?>
<script language="javascript">document.location.href='kasir/dashboard.php'</script>
<?php
}
else{
?>
<!DOCTYPE html>
<html>
<head>
<title>Login Kasir</title>
</head>
<body>
<?php
error_reporting(0);
$status=$_GET['status'];
$loginas=$_GET['loginas'];

?>
<center>
<h1>Form Login</h1><br>
<h2><?php echo $status;?></h2>
<br>
<form method="POST" action="login_action.php">
<table>
<tr>
<td>Login Sebagai</td>

<?php if($loginas=='kasir'){?>
<td>
<select name="loginas">
<option value="admin">Admin</option>
<option value="kasir" selected="true">Kasir</option>
</select>
</td>
<?php }
else{ ?>
<td>
<select name="loginas">
<option value="admin">Admin</option>
<option value="kasir">Kasir</option>
</select>
</td>
<?php } ?>

</tr>
<tr>
<td>ID</td>
<td><input type="text" name="id"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="1"><button type="submit">Log in</button></td>
</tr>

</table>
</form>

</center>
</body>
</html>

<?php
}?>

halaman dashboard

<?php session_start();
if(isset($_SESSION['id_admin'])){

?>

<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- bootstrap.css CDN -->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/dashboard.css" rel="stylesheet" />

  </head>
  <body>
<?php $admin=ucwords($_SESSION['nama']);?>

 <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
         <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-home"></span>
          Dashboard Admin</a>

                </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
         
            <li><a href="#">Bantuan</a></li>
<li>

<a href="logout_action.php" onClick="return confirm(' <?php echo $admin;?>, Apakah Anda yakin akan keluar?')">Logout</a></li>


          </ul>
       
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li class="active"><a href="dashboard.php">Beranda <span class="sr-only">(current)</span></a></li>
       
          </ul>
          <ul class="nav nav-sidebar">
            <li><a href="input.php">Input Menu</a></li>
<li><a href="kelola.php">Kelola Menu</a></li>
       
          </ul>
 
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <h1 class="page-header">Beranda</h1>

       
<h3>Assalamualaikum... <?php

echo $admin;



?></h3>
<p> Selamat datang di dashboard aplikasi Kasir Restaurant, semoga aplikasi ini membantu kelancaran bisnis kuliner anda. Terimakasih</p>
<br>"Jika terjadi error dalam aplikasi ini, harap hubungi kami" (Pengembang)</font>
<br>
       


          </div>
        </div>
      </div>
    </div>



<!-- /container -->

    <!-- ===================
            SCRIPTS
    ======================== -->
    <!-- jQuery.js CDN -->
    <script src="js/jquery.min.js"></script>

    <!-- bootstrap.js CDN -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

<?php
}else{
?><script language="javascript">document.location.href='index.php?status=Anda belum login!'</script><?php
}
?>

form input

<?php session_start();
if(isset($_SESSION['id_admin'])){  => masuk sebagai admin

?>

<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- bootstrap.css CDN -->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/bootstrap.css" rel="stylesheet" />
    <link href="css/dashboard.css" rel="stylesheet" />
 
  </head>
  <body>


 <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
         <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-home"></span>
          Dashboard Admin</a>
       
                </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
         
            <li><a href="#">Bantuan</a></li>
            <li>
         
            <a href="logout_action.php" onClick="return confirm('Apakah Anda yakin akan keluar?')">Logout</a></li>
         

          </ul>
       
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li ><a href="dashboard.php">Beranda <span class="sr-only">(current)</span></a></li>
       
          </ul>
          <ul class="nav nav-sidebar">
            <li class="active"><a href="input.php">Input Menu</a></li>
            <li><a href="kelola.php">Kelola Menu</a></li>
       
          </ul>
 
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <h1 class="page-header">Input Menu</h1>

       
<h3>Input Menu Makan/ Minuman</h3> =>form input

    <form role="form" method="post" action="prosesinput.php" id="forminput">
    <table width="400">
        <tr>
            <td>Kode Menu</td>
            <td><input type="text" name="kdmenu" placeholder="Kode Menu" required id="kdmenu" onchange="validasi()" > </td> => validasi form kode menu harus diisi dan harus angka 
        </tr>
        <tr>
            <td>Nama Menu</td>
            <td><input type="text" name="nama_menu" placeholder="Nama Menu" required="true" > </td> => validasi form nama  menu harus diisi 
        </tr>
        <tr>
            <td>Jenis</td>
            <td>
                <select name="jenis" width="50px">
                  <option value="Makanan">Makanan</option>
                  <option value="Minuman">Minuman</option>
                  <option value="Snack">Snack</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>Harga</td>
            <td> <input type="text" name="harga" placeholder="Harga" required="true"> </td>
        </tr> => validasi form harga harus diisi 
    </table>
 
    <input type="submit" value="Submit" >

  </form>

<script type="text/javascript">

  function validasi(){   => validasi kode menu harus angka
  var kdmenu= document.forms["forminput"]["kdmenu"].value;
  var number=/^[0-9]+$/;
 
  if(kdmenu.length <3)
    alert("kode harus lebih dr 3");
 else if (!kdmenu.match(number))
    alert("Harus Angka");
 
    return false;
  };
}

</script>
       
       
          </div>
        </div>
      </div>
    </div>

 
 
    <!-- /container -->

    <!-- ===================
            SCRIPTS
    ======================== -->
    <!-- jQuery.js CDN -->
    <script src="js/jquery.min.js"></script>

    <!-- bootstrap.js CDN -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

<?php
}else{
    ?><script language="javascript">document.location.href='index.php?status=Anda belum login!'</script><?php
}
?>


proses input

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
$host = "localhost";
$username= "root";
$password ="";
$database="rest";

 $konek = new mysqli($host, $username, $password, $database);

 if($konek->connect_error){
die("errornya adalah : ".$konek->connect_error);
}

$kodemenu =$_POST["kdmenu"];
$namamenu =$_POST["nama_menu"];
$jenis   =$_POST["jenis"];
$harga   =$_POST["harga"];

$sql =mysqli_query($konek, "INSERT INTO menu values('$kodemenu','$namamenu','$jenis','$harga')");

if($sql){
echo "INPUT DATA BERHASIL";
}
else{
echo "INPUT DATA";
}
 ?>


</script>

<a href="input.php"><button>Kembali</button></a>
</body>


</html>

tampilan form input


halaman kelola menu ( daftar menu )

<?php session_start();
if(isset($_SESSION['id_admin'])){

?>

<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- bootstrap.css CDN -->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
  <link href="css/bootstrap.css" rel="stylesheet" />
  <link href="css/dashboard.css" rel="stylesheet" />

  </head>
  <body>
<?php $admin=ucwords($_SESSION['nama']);
   


?>

 <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
         <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-home"></span>
          Dashboard Admin</a>
   
                </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
         
            <li><a href="#">Bantuan</a></li>
      <li>
   
      <a href="logout_action.php" onClick="return confirm(' <?php echo $admin;?>, Apakah Anda yakin akan keluar?')">Logout</a></li>
   

          </ul>
       
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li><a href="dashboard.php">Beranda <span class="sr-only">(current)</span></a></li>
       
          </ul>
          <ul class="nav nav-sidebar">
            <li><a href="input.php">Input Menu</a></li>
      <li class="active"><a href="kelola.php">Kelola Menu</a></li>
       
          </ul>
 
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <h1 class="page-header">Kelola Menu</h1>

         <center>
          <h3>Daftar Menu</h3>
          <table width="80%" border="1">
            <tr>
              <td align="center" width="25px">No</td>
              <td align="center">Id</td>
              <td align="center">Nama</td>
              <td align="center">Harga</td>
              <td align="center">Aksi</td>
            </tr>
            <?php

                $host     ="localhost";
                $username ="root";
                $password ="";
                $database ="rest";

                $konek = new mysqli($host, $username, $password, $database);

                if($konek->connect_error){
                die("errornya adalah : ".$konek->connect_error);
                }

             

                $sql =mysqli_query($konek, "select*from menu order by kdmenu ASC");
                $i=1;
             ?>
          <?php while($row=$sql->fetch_array()){ ?>
            <tr>
              <td align="center"><?php echo $i; ?></td>
              <td align="center"><?php echo $row["kdmenu"]; ?></td>
              <td><?php echo $row["nama_menu"]; ?></td>
              <td><?php echo "Rp. ".$row["harga"]; ?></td>
              <td align="center">
                <a href="editmenu.php?kdmenu=<?php echo $row['kdmenu']; ?>&nama_menu=<?php echo $row['nama_menu'];?>&jenis=<?php echo $row['jenis'];?>&harga=<?php echo $row['harga']; ?>"><button>Edit</button></a>
                <a href="proseshapus.php?kdmenu=<?php echo $row['kdmenu']; ?>"><button>Hapus</button></a>
              </td>
            </tr>
          <?php $i++;} ?>
          </table>

         </center>  
   
          </div>
        </div>
      </div>
    </div>



  <!-- /container -->

    <!-- ===================
            SCRIPTS
    ======================== -->
    <!-- jQuery.js CDN -->
    <script src="js/jquery.min.js"></script>

    <!-- bootstrap.js CDN -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

<?php
}else{
  ?><script language="javascript">document.location.href='index.php?status=Anda belum login!'</script><?php
}
?>

             
proses hapus

<?php

$host = "localhost";
$username= "root";
$password ="";
$database="rest";

$konek = new mysqli($host, $username, $password, $database);

$kdmenu=$_GET['kdmenu'];

$query="DELETE FROM menu WHERE kdmenu = $kdmenu";

mysqli_query($konek,$query);

echo "Hapus Berhasil";?>

<script language=javascript>
setTimeout("location.href='kelola.php'",1000);

</script>
tampilan kelola menu
form untuk edit menu
<?php session_start();
if(isset($_SESSION['id_admin'])){

?>

<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- bootstrap.css CDN -->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/bootstrap.css" rel="stylesheet" />
    <link href="css/dashboard.css" rel="stylesheet" />
 
  </head>
  <body>


 <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
         <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-home"></span>
          Dashboard Admin</a>
       
                </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
         
            <li><a href="#">Bantuan</a></li>
            <li>
         
            <a href="#" onClick="return alert('Anda harus menyelesaikan proses edit!')">Logout</a></li>
         

          </ul>
       
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li class="disabled"><a href="dashboard.php">Beranda <span class="sr-only">(current)</span></a></li>
       
          </ul>
          <ul class="nav nav-sidebar">
            <li class="disabled"><a href="input.php">Input Menu</a></li>
            <li class="active"><a href="#">Edit Menu</a></li>
       
          </ul>
 
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <h1 class="page-header">Edit Menu</h1>

    <?php
    $kdmenu  =$_GET['kdmenu'];
    $nama_menu =$_GET['nama_menu'];
    $jenis=$_GET['jenis'];
    $harga=$_GET['harga'];

     ?>
    <form role="form" method="post" action="prosesedit.php" id="forminput">
    <table width="400">
        <tr>
            <td>Kode Menu</td>
            <td><input type="text" name="kdmenu" value="<?php echo $kdmenu; ?>" disabled="true">
                <input type="hidden" name="kdmenu" value="<?php echo $kdmenu;?>">
            </td>
        </tr>
        <tr>
            <td>Nama Menu</td>
            <td><input type="text" name="nama_menu" placeholder="Nama Menu" required="true" value="<?php  echo $nama_menu?>"> </td>
        </tr>
        <tr>
            <td>Jenis</td>
            <td>
                <!--UNTUK MENETUKAN JENIS YANG DIPILIH-->
                <select name="jenis" width="50px">
                  <?php if($jenis=='Makanan'){?>
                  <option value="Makanan" selected="true">Makanan</option>
                  <option value="Minuman">Minuman</option>
                  <option value="Snack">Snack</option>
                  <?php }
                  elseif($jenis=='Minuman'){?>
                  <option value="Makanan">Makanan</option>
                  <option value="Minuman" selected="true">Minuman</option>
                  <option value="Snack">Snack</option>
                  <?php }
                  else{?>
                  <option value="Makanan">Makanan</option>
                  <option value="Minuman">Minuman</option>
                  <option value="Snack" selected="true">Snack</option>
                  <?php } ?>
                </select>
            </td>
        </tr>
        <tr>
            <td>Harga</td>
            <td> <input type="text" name="harga" placeholder="Harga" required="true" value="<?php echo $harga; ?>"> </td>
        </tr>
    </table>
 
    <input type="submit" value="Update" >

  </form>

<script type="text/javascript">

  function validasi(){
  var kdmenu= document.forms["forminput"]["kdmenu"].value;
  var number=/^[0-9]+$/;

  if (!kdmenu.match(number)) {
    alert("Harus Angka");
    return false;
  };
}
</script>
       
       
          </div>
        </div>
      </div>
    </div>

 
 
    <!-- /container -->

    <!-- ===================
            SCRIPTS
    ======================== -->
    <!-- jQuery.js CDN -->
    <script src="js/jquery.min.js"></script>

    <!-- bootstrap.js CDN -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

<?php
}else{
    ?><script language="javascript">document.location.href='index.php?status=Anda belum login!'</script><?php
}
?>
proses edit

<?php
$host = "localhost";
$username= "root";
$password ="";
$database="rest";

 $konek = new mysqli($host, $username, $password, $database);

$kdmenu=$_POST['kdmenu'];
$nama_menu=$_POST['nama_menu'];
$jenis=$_POST['jenis'];
$harga=$_POST['harga'];

$query="UPDATE menu set nama_menu = '$nama_menu', jenis='$jenis',harga='$harga' where kdmenu='$kdmenu'";


mysqli_query($konek,$query);

echo "Edit Berhasil";?>

<script language=javascript>
setTimeout("location.href='kelola.php'",1000);

</script>

             
tampilan edit menu





         


Sabtu, 17 September 2016

Refleksi Minggu 2

Refleksi 2

Assalamualaikum wr.wb.

Pada minggu kedua ini kita mempelajari tentang  Struct dan Class, dimana pada pembelajaran kali ini kami diminta membuat grup yang terdiri dari 2 kelompok dimana nantinya kami diminta untuk mendalami materi tesebut , satu kelompok mendalami 1 materi dan kemudian kami diminta menjelaskan kepada kelompok lain tentang materi yang telah kelompok kami pelajari, dan kemudian setelah itu kami diminta untuk membuat laporan dari gabungan kedua kelompok yang materinya tentang struct dan class tadi. 

sekian dan terimakasih

Refleksi Minggu1

Refleksi 1

Assalamualaikum wr.wb.

Alhamdulillah setelah sekian lama saya recent dari dunia perblogan ini, kali ini kita dipertemukan lagi namun bukan dengan mata kuliah alpro  melainkan dengan mata kuliah struktur data .
Pada minggu pertama ini seperti biasa hanya kontrak kuliah yang kemudian dilanjutkan dengan pembahasan sedikit materi.
Pada materi minggu pertama ini kita mempelajari tentang dasar-dasar pemrograman C++, seperti : parameter nilai, fungsi template, reference nilai, const reference parameter,  Alokasi memori dinamis, Array satu dimensi dinamis, penanganan perkecualian, operator delete, method, method overloading, object dan class.

Sekian dan terimakasih  

Kamis, 09 Juni 2016

Refleksi 13

Rabu pukul 7.00 kuliah alpro dimulai, pertemuan kali ini pertemuan pertama kami di bulan Ramadhan, pada pertemuan ketigabelas ini kami berkelompok disuruh mengerjakan tentang IPK dan setiap anggota kelompok mendapat bagian masing-masing , diantaranya ada yang mengerjakan algoritma, struct, dan menghitung IPK .

sekian dan terimakasih ^^

Senin, 06 Juni 2016

program sederhana

1. Menghitung nilai rata-rata sederhana

Dev C++

source code :

#include <iostream>
#include <conio.h>

using namespace std;

int main() {
   
    float angka, total = 0, rata;
    int jumlah;
   
    cout << "1. Mencari Rata-rata. (jumlah angka ditentukan)" << endl;
    cout << endl;
    cout << "masukkan jumlah angka      : "; cin >> jumlah;
    cout << endl;
   
    for (int i = 1; i <= jumlah; i++) {
        cout << "Masukkan angka            : "; cin >> angka;
        total = total + angka;
    }
   
    cout << endl;
    cout << "Total                      : " << total << endl;
    rata = total / jumlah;
    cout << "Rata-rata                 : " << rata;
    return 0;
}

outputnya :

2. Mencari nilai max, min dan rata

Dev C++

source code :

#include <cstdlib>
#include <iostream>
 
using namespace std;
 
int main(int argc, char *argv[])
{
    int x[100],n,max,min,i;
    double a,b;
    cout<<"Masukkan Banyaknya Data : ";cin>>n;
    for (i=0;i<n;i++)
    {
     cout<<"Masukan Nilai " <<i+1<<" : ";cin>>x[i];
    }
    max = x[0];
    min = x[0];
    for (i=0;i<n;i++)
    {
     if (max < x[i])
     {
       max = x[i];
      }
     if (min > x[i])
     {
       min = x[i];
      }
    }
    cout<<"Nilai tertinggi = "<<max<<endl;
    cout<<"Nilai terendah = "<<min<<endl;
    a=0;
    for (int i=0;i<n;i++)
    {
     a=a+x[i];
    }
    b=a/n;
    cout<<"Rata-Rata : "<<a<<"/"<<n<<" = "<<b<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;  

}

outputnya :

3. Mencari nilai pangkat

Dev C++

source code :

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int kali(int i, int n, int p){
if(i<=n)
return p*kali(i+p,n,p);
}
int main(int argc, char** argv) {
int x,y,i=0;

cout<<"menghitung hasil perpangkatan\n";
cout<<"nilai pertama:";cin>>x;
cout<<"masukan hasil pangkat:";cin>>y;
cout<<"hasil="<<kali(i,y,x);
return 0;
}

outputnya :


Refleksi 12

Pada pertemuan ke 12 ini kami sudah memasuki ke materi record, pada pertemuan tadi kami membahas sedikit tentang bedanya record array, dan beda struct class. Sebenarnya minggu ini adalah minggu-minggu yang sibuk bagi kami. Kenapa? Karena minggu ini kami sudah harus mempresentasikan Tugas Proyek kami. 

Sekian dan Terimakasih ^^

Rabu, 25 Mei 2016

Mengalikan Vektor (2 elemen) dengan Matriks berukuran 2x3 dan Vektor (3 elemen)

Analisa Masalah


1. Identifikasi Masalah
=> Mengalikan Vektor (2 elemen) dengan Matriks berukuran 2x3 dan Vektor (3 elemen)

2. Menentukan input dan output
Input :
matrix [2] [3] = {4,7,2,6,3,1}
vektor [3] = {3,0,2}  
vek [2] = {2,5}
Output :
Hasil perkalian matrix 2x3 dan vektor 3 elemen :
16
20

Hasil perkalian vektor(elemen 2) dengan matrix elemen 2x3 dan vektor(elemen 3) :
32
100

3. Membuat Flowchart atau Algoritma
Algoritma Perkalian_Matrix
{ Menghitung hasil perkalian vektor(elemen 2) dengan matrix elemen 2x3 dan vektor(elemen 3)}

Deklarasi :
matrix [2] [3] = {4,7,2,6,3,1}              : integer
vektor [3] = {3,0,2}                            : integer
vek [2] = {2,5}                                  : integer
hasil [2] ={0}                                      : integer

Deskripsi :
Write('Matrik elemen 2x3 : \n')
            for i ß 0 to 2 do then i++
                        for j ß 0 to 3 then j++
                                    hasil[i] ß hasil[i]+(matrix[i][j]*vektor[j]);
            end for
                        end for

for i ß 0 to 2 do then i++
            for j ß 0 to 3 then j++ then
                        write(hasil[i][j])
            end for
                        end for

write(‘Vektor 3 elemen: \n’)
            for j ß 0 to 3 then j++ then
                        write(vektor[i])
end for

write(‘Vektor 2 elemen : \n’)
            for i ß 0 to 2 then i++ then
                        write(vek[i])
end for

write(‘Hasil perkalian matrix 2x3 dan vektor 3 elemen : \n’)
            for i ß 0 to 2 then i++
                        write(hasil[i])
end for

write(‘Hasil perkalian vektor(elemen 2) dengan matrix elemen 2x3 dan vektor(elemen 3) : \n’)
for i ß 0 to 2 then i++
                        hasil[i] ßhasil[i]*vek[i];
                        write(hasil[i])

end for

4. Test Menggunakan data
Input :
matrix [2] [3]:  | 4 7 2 |
 | 6 3 1 |
vektor [3]        : | 3 |
                          | 0 |
                          | 2 |
vek [2]   |  2  |
               | 5 |
Output :
Hasil perkalian matrix 2x3 dan vektor 3 elemen :
16
20

Kemudian hasilnya dikalikan dengan asil perkalian vektor(elemen 2) ,
Hasil akhirnya adalah :
32
100

5. Implementasi c++
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

void perkalian(int matrix[2][3],int vektor[3],int hasil[2]){
cout<<"Matrik elemen 2x3 : \n";
for(int i=0;i<2;i++){
for(int j=0;j<3;j++)
hasil[i]=hasil[i]+(matrix[i][j]*vektor[j]);
}
}

void cetakmatrix(int hasil[][3]){
for(int i=0;i<2;i++){
for(int j=0;j<3;j++)
cout<<hasil[i][j]<<" ";
cout<<endl;
}
}

void cetakvektor(int vektor[]){
cout<<"Vektor 3 elemen: \n";
for(int i=0;i<3;i++){
cout<<vektor[i]<<endl;
}
}

void cetakb(int vek[]){
cout<<"Vektor 2 elemen : \n";
for(int i=0;i<2;i++){
cout<<vek[i]<<endl;
}
}
void cetak(int hasil[]){
cout<<"Hasil perkalian matrix 2x3 dan vektor 3 elemen : \n";
for(int i=0;i<2;i++){
cout<<hasil[i]<<endl;
}
}

void cetaka(int vek[2],int hasil[]){
cout<<"Hasil perkalian vektor(elemen 2) dengan matrix elemen 2x3 dan vektor(elemen 3) : \n";
    for(int i=0;i<2;i++){
hasil[i]=hasil[i]*vek[i];
cout<<hasil[i]<<endl;
}
}

int main(int argc, char** argv) {
int matrix[2][3]={4,7,2,6,3,1}, vektor[3]={3,0,2},vek[2]={2,5},hasil[2]={0};
perkalian(matrix,vektor,hasil);
cetakmatrix(matrix);
cetakvektor(vektor);
cetak(hasil);
cetakb(vek);
cetaka(vek,hasil);
return 0;
}

6. Exekusi