Minggu, 16 Desember 2012

Kuis C++


#include <iostream.h>
#include <math.h>

void Panjang(int x_1, int x_2, int y_1, int y_2)
{
float hasil;
if(x_2==x_1)
{
hasil = abs (y_2 - y_1);
}
else if (y_2==y_1)
{
hasil= abs (x_2-x_1);
}
else
{
hasil=sqrt((x_2-x_1)*(x_2-x_1) + (y_2-y_1)*(y_2-y_1));
}
cout<<"hasil = "<<hasil;
}


int main()
{
int a, b, c, d;

cout<<"Masukkan Nilai X1 : ";
cin>>a;
cout<<"Masukkan Nilai X2 : ";
cin>>b;
cout<<"Masukkan Nilai Y1 : ";
cin>>c;
cout<<"Masukkan Nilai Y2 : ";
cin>>d;

Panjang(a,b,c,d);



return 0;

}

Senin, 10 Desember 2012

MENCARI WAKTU KENDARAAN MENGGUNAKAN C++

Coding
Menggunakan  menggunakan rumus kecepatan GLB t=s/v

#include "stdafx.h"
#include <iostream.h>

int waktu (int s,int v)

{
 int hasil;
 hasil = s / v;
 return hasil;
}


int main()
{
 int s,v,hasil;
 cout <<"MENENTUKAN WAKTU TEMPUH KENDARAAN"<<endl;
 cout <<"Masukkan nilai jarak : ";
 cin >> s;
 cout <<"Masukkan nilai kecepatan : ";
 cin >> v;
 hasil=waktu(s,v);
 cout <<"Hasil waktu tempuh = "<<hasil<<endl;
 return 0;
}


Output nya :











Menggunakan Rumus GLBB

#include "stdafx.h"
#include <iostream.h>

float waktu (float vo,float vt,float a)

{
 float hasil;
 hasil = vt / (vo + a);
 return hasil;
}

int main()

{
 float vo,vt,a,hasil;
 cout <<"MENENTUKAN WAKTU TEMPUH KENDA
RAAN"<<endl;
 cout <<"Masukkan kecepatan awal : ";
 cin >> vo;
 cout <<"Masukkan kecepatan akhir : ";
 cin >> vt;
 cout <<"Masukkan percepatan : ";
 cin >> a;
 hasil=waktu(vo,vt,a);
 cout <<"Hasil waktu tempuh = "<<hasil<<endl;
 return 0;
}

Output nya :

Minggu, 02 Desember 2012

Membuat aplikasi untuk penyimpanan dan penampilan menu masakan menggunakan VB


Private Sub mexit_Click()
End
End Sub
----------------------------------------------
Private Sub mjenis_Click()
Form2.Show
End Sub
----------------------------------------------
Private Sub mkanan_Click()
Form1.Show
End Sub
----------------------------------------------
Private Sub mtambah_Click()
Form3.Show
End Sub

coding pada form

Private Sub Next_Click()
MDIForm1.Show
End Sub
----------------------------------------------------------------
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset!Jenis_Masakan = Tjenis.Text
Adodc1.Recordset!Nama_Masakan = Tnama.Text
Adodc1.Recordset!Bahan = Tbahan.Text
Adodc1.Recordset!Cara_memasak = Tcara.Text
Adodc1.Recordset.Update
MsgBox "Data Sudah Di Simpan!"
End Sub
-----------------------------------------------------------------
Private Sub Form_Load()
Adodc1.RecordSource = "select*from resep"
Adodc1.Refresh
End Sub

Private Sub btTampil_Click()
Adodc1.RecordSource = "select * from resep where Jenis_Masakan = '" & Tjenis.Text & "'"
Adodc1.Refresh
baris = 1
While Not Adodc1.Recordset.EOF
fg1.Row = baris
fg1.Col = 0
fg1_text = baris
fg1.Col = 1
fg1.Text = Adodc1.Recordset!Nama_Masakan
Adodc1.Recordset.MoveNext
baris = baris + 1
Wend
End Sub
-----------------------------------------------------------------
Private Sub fg1_Click()
fg1.ColWidth(0) = 1500
fg1.ColWidth(1) = 1500
End Sub
-----------------------------------------------------------------
Private Sub Form_Load()
fg1.Row = 0
fg1.Col = 0
fg1.Col = 1
fg1.Text = "NamaMakanan"
End Sub

coding pada form 3

Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset!Jenis_Masakan = Tjenis.Text
Adodc1.Recordset.Update
MsgBox "Data Masakan Sudah Di Simpan!"
End Sub
----------------------------------------------------------------
Private Sub Command2_Click()
MDIForm1.Show
End Sub
-----------------------------------------------------------------
Private Sub Form_Load()
Adodc1.RecordSource = "select * From resep"
Adodc1.Refresh
End Sub