Minggu, 16 Desember 2012

Tugas Quiz C++





//Fadril 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;

}
 
klik gamar untuk memperbesar

Minggu, 02 Desember 2012

TUGAS PROGRAM VISUAL BASIC Menampilkan Daftar Menu Makanan










 Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset!jenis_makanan = tjenis.Text
Adodc1.Recordset!nama_masakan = tnama.Text
Adodc1.Recordset!bahan = tbahan.Text
Adodc1.Recordset!cara_memasak = tcara.Text
Adodc1.Recordset.Update
MsgBox " Data anda telah Di simpan ..!!"
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Form2.Show
End Sub

Private Sub Form_Load()
Adodc1.RecordSource = "Select * From resep"
Adodc1.Refresh
End Sub

Private Sub Label1_Click()

End Sub

Private Sub tbahan_Change()

End Sub

Private Sub tcara_Change()

End Sub

Private Sub tjenis_Change()

End Sub








Private Sub bttampil_Click()
Adodc1.RecordSource = "Select * From Resep where jenis_makanan='" & tjenis.Text & "'"
Adodc1.Refresh
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 Command1_Click()
Form3.Show
End Sub

Private Sub Form_Load()
fg1.Row = 0
fg1.Col = 0
fg1.Text = "No"
fg1.Col = 1
fg1.Text = "Bahan"

fg1.ColWidth(0) = 500
fg1.ColWidth(1) = 2500
End Sub