Disusun Oleh :
pg. 1
DAFTAR ISI
i. Cover…………………………………………………………...…1
ii. Daftar Isi………………………………………………………….2
iii. Tugas Console……………………………………………………5
Tugas 1……………………………………………………...5
Tugas 2……………………………………………………...6
Tugas 3……………………………………………………...8
Tugas 4……………………………………………………...9
Tugas 5…………………………………………………….11
Tugas 6…………………………………………………….12
Tugas 7…………………………………………………….15
Tugas 8…………………………………………………….16
Tugas 9…………………………………………………….18
Tugas 10…………………………………………………...20
iv. Tugas Visual…………………………………………………….22
Tugas 11…………………………………………………...22
Tugas 12…………………………………………………...23
Tugas 13…………………………………………………...26
Tugas 14…………………………………………………...27
Tugas 15…………………………………………………...29
Tugas 16…………………………………………………...31
pg. 2
Tugas 17…………………………………………………...33
Tugas 18…………………………………………………...34
Tugas 19…………………………………………………...37
Tugas 20…………………………………………………...38
Tugas 21…………………………………………………...41
Tugas 22…………………………………………………...43
v. PR Ari Reza Koswara…………………………………………..46
PR 01………………………………………………………46
PR 02………………………………………………………47
PR 03………………………………………………………48
PR 04………………………………………………………50
PR 05………………………………………………………51
PR 06………………………………………………………53
PR 07………………………………………………………54
PR 08………………………………………………………56
PR 09………………………………………………………58
PR 10………………………………………………………59
PR 11………………………………………………………60
PR 12………………………………………………………62
vi. PR Gatot Yudhanto…………………………………………….65
PR 01………………………………………………………65
PR 02………………………………………………………66
pg. 3
PR 03………………………………………………………68
PR 04………………………………………………………69
PR 05………………………………………………………71
PR 06………………………………………………………72
PR 07………………………………………………………74
PR 08………………………………………………………75
PR 09………………………………………………………78
PR 10………………………………………………………79
PR 11………………………………………………………81
PR 12………………………………………………………84
pg. 4
Tugas dan PR Prokom
Tugas
TUGAS CONSOLE
pg. 5
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
//type data
float Bila,Diskon5,HargaD10,HargaD5,Diskon10;
printf("Menghitung harga yang terkena Diskon\n");
printf("Dibuat oleh Ari dan Gatot\n Nim 10872 dan 12283\n");
printf("======================================\n\n");
//input
printf("Masukkan harga Pembelian = ");
scanf("%f",&Bila);
//Procces
if(Bila>=100000)
{printf("\nMendapatkan diskon 10 %% ");
Diskon10=Bila*0.1;
HargaD10=Bila-(Bila*0.1);
printf("\nPotongan diskon = %.2f",Diskon10);
printf("\nHarga setelah di diskon 10%% = %.2f",HargaD10);
}
if(Bila<100000)
{printf("Mendapatkan diskon 5 %% ");
Diskon5=Bila*0.05;
HargaD5=Bila-(Bila*0.05);
printf("\nPotongan diskon = %.2f",Diskon5);
printf("\nHarga setelah di diskon 5%% = %.2f",HargaD5);
}
getch();
}
pg. 6
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float X;
pg. 7
{printf("anda mendapat nilai C");
}
if(X>30 && X<=54)
{printf("anda mendapat nilai D");
}
if(X>=0 && X<=29)
{printf("anda mendapat nilai E");
}
if (X>100)
{printf("data tidak valid");
}
if (X<0)
{printf("data tidak valid");
}
getch();
}
#include <stdio.h>
pg. 8
#include <conio.h>
void main()
{
float alas,tinggi,panjang,lebar,Pi,r,luas;
int menu;
printf("Menghitung luas\n");
printf("Dibuat oleh Ari dan Gatot\n Nim 10872 dan 12283\n");
printf("======================================\n\n");
pg. 9
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float sinA,cosA,tanA,X;
int no;
printf("Menghitung TRIGONOMETRI\n");
printf("Dibuat oleh Gatot dan Ari\n Nim 12283 dan 10872\n");
printf("=======================\n");
if (no==1)
{printf(" Menghitung Sin");
printf(" Masukkan nilai = ");scanf("%f",&X);
sinA=sin(X/57.2958);
printf(" Jadi nilainya adalah = %.1f",sinA);
}
else if (no==2)
pg. 10
{printf(" Menghitung Cos");
printf(" Masukkan nilai = ");scanf("%f",&X);
cosA=cos(X/57.2958);
printf(" Jadi nilainya adalah = %.1f",cosA);
}
else if (no==3)
{printf(" Menghitung Tan");
printf(" Masukkan nilai = ");scanf("%f",&X);
tanA=tan(X/57.2958);
{
if (X==90||X==270)
printf("Jadi nilainya adalah = inf");
else
printf(" Jadi nilainya adalah = %.1f",tanA);
}
}
else
printf("ERROR!!!!!!!!!!!!!");
getch();
}
void main()
{
float Celcius,Reamur,Faranheit;
int menu;
switch (menu)
{
case 1:
printf(" Hitung Celcius ke Reamur\n");
printf(" ------------------------\n");
printf(" input Celcius = ");scanf("%f",&Celcius);
Reamur=Celcius*4/5;
printf(" %.2f Reamur",Reamur);
break;
case 2:
printf(" Hitung Celcius ke Faranheit\n");
printf(" ------------------------\n");
printf(" input Celcius = ");scanf("%f",&Celcius);
Faranheit=(Celcius*9/5)+32;
printf(" %.2f Faranheit",Faranheit);
break;
case 3:
printf(" Hitung Reamur ke Faranheit\n");
printf(" ------------------------\n");
printf(" input Reamur = ");scanf("%f",&Reamur);
Faranheit=(Reamur*9/4)+32;
printf(" %.2f Faranheit",Faranheit);
break;
default:
printf(" \n Input Menu Yang Dimasukkan Salah");
}
getch();
}
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main ()
{
int num,number;
float Vawal,Teta,Waktu,Kp,KedP,g,Vt,a;
printf(" Program Soal Fisika\n");
printf(" Dibuat oleh Ari dan Gatot\n Nim 10872 dan 12283\n");
printf(" ======================================\n\n");
switch(num)
pg. 13
{
case 1:
printf("\n\n Gerak Peluru");
printf("\n =================");
printf("\n 1.Gerak Terhadap Sumbu X");
printf("\n 2.Gerak Terhadap Sumbu Y");
printf("\n\n Pilih Gerak Peluru<1/2> = ");
scanf("%d",&number);
switch(number)
{
case 1:
printf("\n\n Gerak Peluru Terhadap Sumbu X");
printf("\n =============================");
printf("\n\n Input Vo= ");
scanf("%f",&Vawal);
printf("\n Input Sudut Teta= ");
scanf("%f",&Teta);
printf("\n Input Waktu= ");
scanf("%f",&Waktu);
Kp=Vawal*cos(Teta/57.2958);
KedP=Vawal*cos(Teta/57.2958)*Waktu;
printf(" Kecepatan Peluru= %.2f",Kp);
printf("\n Kedudukan Peluru= %.2f",KedP);
break;
case 2:
printf("\n\n Gerak Peluru Terhadap Sumbu Y");
printf("\n =============================");
printf("\n\n Input Vo= ");
scanf("%f",&Vawal);
printf("\n Input Sudut Teta= ");
scanf("%f",&Teta);
printf("\n Input Waktu= ");
scanf("%f",&Waktu);
printf(" Input gravitasi=");
scanf("%f",&g);
Kp=Vawal*sin(Teta/57.2958)-(g*Waktu);
KedP=Kp*Waktu-(0.5*g*Waktu*Waktu);
printf(" Kecepatan Peluru= %.2f",Kp);
printf("\n Kedudukan Peluru= %.2f",KedP);
break;
default:
printf(" Kode Tidak ada!!!");
}
break;
case 2 :
pg. 14
if (a<0)
printf ("\n Gerak Diperlambat");
if (a>0)
printf ("\n Gerak Dipercepat");
if (a==0)
printf ("\n Gerak Konstan");
break;
default:
printf("\n Kode Tidak ada!!!");
getch();
}
void main ()
{
int i,n;
float aw,ak,inter,c,r,f,k;
n=(ak-aw)/inter;
for(i=0;i<=n;i=i+1)
{
f=aw+(i*inter);
c=(f-32)*5/9;
r=(f-32)*4/9;
k=c+273;
printf(" | %3d | %3.2f | %3.2f | %4.2f | %4.2f |\n",i+1,f,c,r,k);
}
printf(" -----------------------------------------\n");
getch();
}
pg. 16
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float sudut,t,s,m,sa,sk,i,r;
int n;
r=(sk-sa)/i;
printf("\n Tabel Trigonometri\n");
printf(" --------------------------------------------------------\n");
printf(" | NO | Sudut | Tangen | Cosinus | Sinus |\n");
printf(" --------------------------------------------------------\n");
pg. 17
for (n=0;n<=r;n=n+1)
{
sudut=sa+(n*i);
t=sin(sudut/57.2958);
s=cos(sudut/57.2958);
m=tan(sudut/57.2958);
if(sudut==90)
printf(" | %2.d | %6.2f | inf | %6.2f | %6.2f
|\n",n+1,sudut,s,t);
else if(sudut==270)
printf(" | %2.d | %6.2f | inf | 0.00 | %6.2f
|\n",n+1,sudut,t);
else if (sudut==180)
printf(" | %2.d | %6.2f | 0.00 | %6.2f | %6.2f
|\n",n+1,sudut,s,t);
else if (sudut==360)
printf(" | %2.d | %6.2f | 0.00 | %6.2f | 0.00
|\n",n+1,sudut,s);
else
printf(" | %2.d | %6.2f | %6.2f | %6.2f | %12.2f |\n",n+1,sudut,m,s,t);
printf(" --------------------------------------------------------\n");
getch();
pg. 18
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
void main ()
{
float a,b,i,l,p,r,Mc,Rva,Rvb,Status,x;
int n;
if (a>b)
printf ("\nNilai x Awal < x Akhir !!!");
else if (l<b)
printf ("\nNilai L < x akhir !!!");
else
{
r=(b-a)/i;
printf ("\n Tabel Mekanika Struktur ");
pg. 19
printf ("\n ==============================================================");
printf ("\n | NO | x | Mc | Rva | Rvb | Status |");
printf ("\n ==============================================================");
for(n=0;n<=r;n=n+1)
{
x=a+(n*i);
Rvb=(x/l)*p;
Rva=p-Rvb;
Mc=Rva*x;
if (Rva>Rvb)
printf ("\n | %3d | %4.0f | %8.2f | %8.2f | %8.2f | Rva > Rvb
|",n+1,x,Mc,Rva,Rvb);
else if (Rva<Rvb)
printf ("\n | %3d | %4.0f | %8.2f | %8.2f | %8.2f | Rva < Rvb
|",n+1,x,Mc,Rva,Rvb);
else
printf ("\n | %3d | %4.0f | %8.2f | %8.2f | %8.2f | Rva = Rvb
|",n+1,x,Mc,Rva,Rvb);
}
printf ("\n ==============================================================");
}
getch ();
}
void main()
{
int n,i,no;
float r,a,b,c,x,k;
if (r<10000000)
printf ("\n\n\n ***** Nominal Rupiah Tidak Memenuhi !!! *****");
else if (r>50000000)
printf ("\n\n\n ***** Nominal Rupiah Tidak Memenuhi !!! *****");
else
{
printf("\n\n Tabel Pinjaman");
printf("\n|==========================================================|\n");
printf("| No | Rp | 5x | 10x | Bonus |\n");
printf("|==========================================================|\n");
i=r/5000000;
for (n=0;n<i-1;n=n+1)
{
no=n+1;
x=r-(n*5000000);
a=x/5;
b=x/10;
if (x>=40000000&&x<=50000000)
}
printf("|==========================================================|\n");
}
getch();
}
pg. 21
TUGAS VISUAL
float m,v,g,h,EP,EK,EM;
if (listBox1->SelectedIndex == 0) m=100;
if (listBox1->SelectedIndex == 1) m=200;
if (listBox1->SelectedIndex == 2) m=300;
if (listBox2->SelectedIndex == 0) v=10;
if (listBox2->SelectedIndex == 1) v=20;
pg. 22
if (listBox2->SelectedIndex == 2) v=30;
if (radioButton1->Checked) g=10;
if (radioButton2->Checked) g=9.8;
if (comboBox1->SelectedIndex == 0) h=10;
if (comboBox1->SelectedIndex == 1) h=20;
if (comboBox1->SelectedIndex == 2) h=30;
if(m==0)
MessageBox::Show("masukkan massa !!");
else if(v==0)
MessageBox::Show("masukkan kecepatan !!");
else if(g==0)
MessageBox::Show("masukkan gravitasi !!");
else if(h==0)
MessageBox::Show("masukkan ketinggian !!");
else
{
EP=m*g*h;
EK=0.5*m*v*v;
EM=EP+EK;
label2->Text=Convert::ToString(EK);
label4->Text=Convert::ToString(EP);
label6->Text=Convert::ToString(EM);
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
listBox1->SelectedIndex=-1;
listBox2->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
comboBox1->SelectedIndex=-1;
label2->Text="XXXXXX";
label4->Text="XXXXXX";
label6->Text="XXXXXX";
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
pg. 23
Berikut Program Visual nya :
float rs,rp,as,ap,ds,dp,st,r1,r2,r3,v;
if (comboBox2->SelectedIndex == 0) r2= 5;
if (comboBox2->SelectedIndex == 1) r2= 15;
if (comboBox2->SelectedIndex == 2) r2= 25;
if (listBox1->SelectedIndex == 1) v= 220;
if (listBox1->SelectedIndex == 2) v= 110;
if (r1==0)
MessageBox::Show("Masukan R1!!!");
else if (r2==0)
MessageBox::Show("Masukan R2!!!");\
else if (r3==0)
pg. 24
MessageBox::Show("Masukan R3!!!");
else if (v==0)
MessageBox::Show("Tegangan Harus Diisi!!!");
else
{
rs= r1+r2+r3;
rp= (r1*r2*r3)/((r2*r3)+(r1*r3)+(r1*r2));
as= v/rs;
ap= v/rp;
ds= as*v;
dp= ap*v;
label6->Text = Convert::ToString(rs);
label7->Text = Convert::ToString(rp);
label10->Text = Convert::ToString(as);
label11->Text = Convert::ToString(ap);
label14->Text = Convert::ToString(ds);
label15->Text = Convert::ToString(dp);
if (v==220)
label17->Text = "Tegangan Tinggi";
else
label17->Text = "tegangan Rendah";
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
comboBox1->SelectedIndex=-1;
comboBox2->SelectedIndex=-1;
listBox1->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
radioButton3->Checked=false;
radioButton4->Checked=false;
label5->Text ="xxxxxxx";
label7->Text = "xxxxxxx";
label10->Text = "xxxxxxx";
label11->Text = "xxxxxxx";
label14->Text = "xxxxxxx";
label15->Text = "xxxxxxx";
label17->Text = "xxxxxxx";
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
Close ();
}
pg. 25
13. Program GLBB
Close();
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
comboBox1->SelectedIndex=-1;
comboBox2->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
radioButton3->Checked=false;
radioButton4->Checked=false;
label5->Text="XXXXXX";
label6->Text="XXXXXX";
label7->Text="XXXXXX";
pg. 26
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
float Vo,Vt,t,a,s;
if (comboBox1->SelectedIndex == 1) Vo=10;
if (comboBox1->SelectedIndex == 2) Vo=20;
if (comboBox1->SelectedIndex == 3) Vo=30;
if (comboBox2->SelectedIndex == 1) Vt=10;
if (comboBox2->SelectedIndex == 2) Vt=20;
if (comboBox2->SelectedIndex == 3) Vt=30;
if (radioButton1->Checked) t=10;
if (radioButton2->Checked) t=20;
if (radioButton3->Checked) t=30;
if (radioButton4->Checked) t=40;
if(Vo==0)
MessageBox::Show("Input Vo harus diisi!!");
else if(Vt==0)
MessageBox::Show("Input Vt harus diisi!!");
else if(t==0)
MessageBox::Show("Input t harus diisi!!");
else
{
a=(Vt-Vo)/t;
s=Vo*t+0.5*a*t*t;
if (a>0)
label7->Text = "Dipercepat";
else if (a<0)
label7->Text = "Diperlambat";
else
label7->Text = "Konstan";
label5->Text=Convert::ToString(a);
label6->Text=Convert::ToString(s);
}
}
pg. 27
Berikut Program Visual nya :
comboBox1->SelectedIndex=-1;
comboBox2->SelectedIndex=-1;
comboBox3->SelectedIndex=-1;
label8->Text="xxxxxx";
label9->Text="xxxxxx";
label10->Text="xxxxxx";
label11->Text="xxxxxx";
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
float a,b,c,D,xa,xb;
if (comboBox1->SelectedIndex == 0) a=1;
if (comboBox1->SelectedIndex == 1) a=3;
if (comboBox1->SelectedIndex == 2) a=4;
if (comboBox2->SelectedIndex == 0) b=1;
if (comboBox2->SelectedIndex == 1) b=4;
if (comboBox2->SelectedIndex == 2) b=6;
if (comboBox3->SelectedIndex == 0) c=1;
if (comboBox3->SelectedIndex == 1) c=3;
pg. 28
if (comboBox3->SelectedIndex == 2) c=5;
if (a==0)
MessageBox::Show("Input a tidak boleh nol !!");
else if (b==0)
MessageBox::Show("Input b tidak boleh nol !!");
else if (c==0)
MessageBox::Show("Input c tidak boleh nol !!");
else
{
D=pow(b,2)-4*a*c;
if (D<0)
{
xa=(-b+sqrt(-D))/(2*a);
xb=(-b-sqrt(-D))/(2*a);
}
if (D>=0)
{
xa=(-b+sqrt(D))/(2*a);
xb=(-b-sqrt(D))/(2*a);
}
label8->Text=Convert::ToString(D);
label9->Text=Convert::ToString(xa);
label10->Text=Convert::ToString(xb);
if (D>0)
label11->Text = "Dua Akar Real";
else if (D<0)
label11->Text = "Dua Akar Imaginer";
else
label11->Text = "Dua Akar Kembar";
}
pg. 29
Berikut Program Visual nya :
pg. 31
Berikut Program Visual nya :
pg. 32
17. Program GLBB
pg. 34
Berikut Program Visual nya :
else
{
if (comboBox1->SelectedIndex == 1) ma=10;
if (comboBox1->SelectedIndex == 2) ma=20;
if (comboBox1->SelectedIndex == 3) ma=30;
if (comboBox2->SelectedIndex == 1) mk=100;
if (comboBox2->SelectedIndex == 2) mk=120;
if (comboBox2->SelectedIndex == 3) mk=140;
if (radioButton1->Checked) inter=1;
if (radioButton2->Checked) inter=2;
if (comboBox3->SelectedIndex == 1) h=10;
if (comboBox3->SelectedIndex == 2) h=20;
if (comboBox3->SelectedIndex == 3) h=30;
if (listBox1->SelectedIndex == 1) g=9.8;
if (listBox1->SelectedIndex == 2) g=10;
if (comboBox4->SelectedIndex == 1) v=10;
if (comboBox4->SelectedIndex == 2) v=20;
if (comboBox4->SelectedIndex == 3) v=30;
n=(mk-ma)/inter;
dataGridView1->RowCount=n+1;
for(i=0;i<=n;i=i+1)
{
no=i+1;
dataGridView1->Rows[i]->Cells[0]->Value=no;
x=ma+(i*inter);
dataGridView1->Rows[i]->Cells[1]->Value=x;
ek=0.5*x*v*v;
dataGridView1->Rows[i]->Cells[2]->Value=ek;
ep=x*g*h;
dataGridView1->Rows[i]->Cells[3]->Value=ep;
em=ep+ek;
dataGridView1->Rows[i]->Cells[4]->Value=em;
}
pg. 36
}
}
if (comboBox1->SelectedIndex == -1)
MessageBox::Show("Input R awal !!!");
else if (comboBox2->SelectedIndex == -1)
MessageBox::Show("Input R akhir !!!");
else if (radioButton1->Checked==false&&radioButton2-
>Checked==false&&radioButton3->Checked==false&&radioButton4->Checked==false)
MessageBox::Show("Input interval!");
else
{
if (comboBox1->SelectedIndex == 1) Ra=0;
if (comboBox1->SelectedIndex == 2) Ra=30;
if (comboBox1->SelectedIndex == 3) Ra=60;
if (comboBox2->SelectedIndex == 1) Rk=50;
if (comboBox2->SelectedIndex == 2) Rk=80;
if (comboBox2->SelectedIndex == 3) Rk=100;
if (radioButton1->Checked) intv=1;
if (radioButton2->Checked) intv=2;
if (radioButton3->Checked) intv=5;
if (radioButton4->Checked) intv=10;
n=(Rk-Ra)/intv;
dataGridView1->RowCount=n+1;
for(i=0;i<=n;i++)
{
no=i+1;
R=Ra+(i*intv);
C=(R*5/4);
F=(R*9/4)+32;
K=(R*5/4)+273;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=R;
dataGridView1->Rows[i]->Cells[2]->Value=C;
dataGridView1->Rows[i]->Cells[3]->Value=F;
dataGridView1->Rows[i]->Cells[4]->Value=K;
}
}
}
pg. 38
Berikut Program Visual nya :
dataGridView1->RowCount=1;
dataGridView1->Rows[0]->Cells[0]->Value="";
dataGridView1->Rows[0]->Cells[1]->Value="";
dataGridView1->Rows[0]->Cells[2]->Value="";
dataGridView1->Rows[0]->Cells[3]->Value="";
dataGridView1->Rows[0]->Cells[4]->Value="";
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
pg. 39
int i,n;
float s,c,t,saw,sak,intv,sdt,no;
if(listBox1->SelectedIndex==-1) //Apabila
mengosongkan listbox 1
MessageBox::Show("Input Sudut Awal !!");
else if(listBox2->SelectedIndex==-1)
//Apabila mengosongkan listbox 2
MessageBox::Show("Input Sudut Akhir !!");
else if (radioButton1->Checked==false&&radioButton2-
>Checked==false&&radioButton3->Checked==false&&radioButton4->Checked==false)
//Apabila mengosongkan pada input interval
MessageBox::Show("Input Interval !!");
else // Jika dimasukan makan akan muncul rumus seperti
dibawah
{
n=(sak-saw)/intv;
dataGridView1->RowCount=n+1;
for(i=0;i<=n;i=i++)
{
no=i+1;
sdt=saw+(i*intv);
s=sin(sdt/57.2958);
c=cos(sdt/57.2958);
t=tan(sdt/57.2958);
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=sdt;
if(sdt==180)
dataGridView1->Rows[i]->Cells[3]->Value="0";
else if(sdt==360)
dataGridView1->Rows[i]->Cells[3]->Value="0";
else
dataGridView1->Rows[i]->Cells[3]->Value=s;
if(sdt==90)
dataGridView1->Rows[i]->Cells[4]->Value="0";
else if(sdt==270)
dataGridView1->Rows[i]->Cells[4]->Value="0";
else
dataGridView1->Rows[i]->Cells[4]->Value=c;
pg. 40
if(sdt==90)
//ada perlakuan khusus maka menggunakan if dan else if
dataGridView1->Rows[i]->Cells[2]->Value="inf";
else if(sdt==180)
dataGridView1->Rows[i]->Cells[2]->Value="0";
else if(sdt==360)
dataGridView1->Rows[i]->Cells[2]->Value="0";
else if (sdt==270)
dataGridView1->Rows[i]->Cells[2]->Value="inf";
else
dataGridView1->Rows[i]->Cells[2]->Value=t;
}
}
}
pg. 41
{
float no,vtaw,vtakh,t,vo,i,n,vt,a,s,status;
if (comboBox1->SelectedIndex == 1) vtaw=100;
if (comboBox1->SelectedIndex == 2) vtaw=200;
if (comboBox1->SelectedIndex == 3) vtaw=300;
if (comboBox2->SelectedIndex == 1) vtakh=400;
if (comboBox2->SelectedIndex == 2) vtakh=500;
if (comboBox2->SelectedIndex == 3) vtakh=600;
if (listBox1->SelectedIndex == 1) vo=150;
if (listBox1->SelectedIndex == 2) vo=200;
if (listBox1->SelectedIndex == 3) vo=300;
if (radioButton1->Checked) t=5;
if (radioButton2->Checked) t=10;
if (radioButton3->Checked) t=15;
if (radioButton4->Checked) t=20;
if (comboBox1->SelectedIndex ==-1||comboBox1-
>SelectedIndex ==0)
MessageBox::Show("Input Vt awal !!");
else if (comboBox2->SelectedIndex ==-1||comboBox2-
>SelectedIndex ==0)
MessageBox::Show("Input Vt Akhir !!");
else if (listBox1->SelectedIndex ==-1||listBox1-
>SelectedIndex ==0)
MessageBox::Show("Input Vo !!");
else if (t==0)
MessageBox::Show("Input Waktu (t) !!");
else
{
n=(vtakh-vtaw)/5;
dataGridView1->RowCount=n+1;
for(i=0;i<=n;i++)
{
no=i+1;
vt=vtaw+(i*5);
a=(vt-vo)/t;
s=(vo*t)+(a*t*t)/2;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=vt;
dataGridView1->Rows[i]->Cells[2]->Value=a;
dataGridView1->Rows[i]->Cells[3]->Value=s;
if (a>0)
dataGridView1->Rows[i]->Cells[4]->Value="Dipercepat";
else if (a<0)
pg. 42
dataGridView1->Rows[i]->Cells[4]->Value="Diperlambat";
else
dataGridView1->Rows[i]->Cells[4]->Value="Konstan";
}
}
;}
;
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e)
{
comboBox1->SelectedIndex=-1;
comboBox2->SelectedIndex=-1;
listBox1->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
radioButton3->Checked=false;
radioButton4->Checked=false;
dataGridView1->RowCount=1;
dataGridView1->Rows[0]->Cells[0]->Value="";
dataGridView1->Rows[0]->Cells[1]->Value="";
dataGridView1->Rows[0]->Cells[2]->Value="";
dataGridView1->Rows[0]->Cells[3]->Value="";
dataGridView1->Rows[0]->Cells[4]->Value="";
}
pg. 43
Berikut Program Visual nya :
dataGridView1->RowCount=1;
dataGridView1->Rows[0]->Cells[0]->Value="";
dataGridView1->Rows[0]->Cells[1]->Value="";
dataGridView1->Rows[0]->Cells[2]->Value="";
dataGridView1->Rows[0]->Cells[3]->Value="";
}
private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender,
System::EventArgs^ e)
{
if (comboBox1->SelectedIndex == 0)
{
groupBox1->Text="Input mm Akhir";
Column2->HeaderText="mm";
Column3->HeaderText="cm";
Column4->HeaderText="dm";
}
if (comboBox1->SelectedIndex == 1)
{
groupBox1->Text="Input cm Akhir";
Column2->HeaderText="cm";
Column3->HeaderText="dm";
Column4->HeaderText="mm";
}
if (comboBox1->SelectedIndex == 2)
{
groupBox1->Text="Input dm Akhir";
Column2->HeaderText="dm";
Column3->HeaderText="mm";
Column4->HeaderText="cm";
}
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
int i,n;
float no,mm,cm,dm,x;
if (comboBox1->SelectedIndex == -1)
MessageBox::Show("Input Satuan !!!");
pg. 44
else if (radioButton1->Checked == false&&radioButton2-
>Checked == false)
MessageBox::Show("Input Diisi !!!");
else
{
if (radioButton1->Checked) x=10;
if (radioButton2->Checked) x=20;
n=x/5;
dataGridView1->RowCount=n+1;
for(i=0;i<=n;i=i+1)
{
no=i+1;
if (comboBox1->SelectedIndex == 0)
{
mm=(i*5);
cm=mm/10;
dm=mm/100;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=mm;
dataGridView1->Rows[i]->Cells[2]->Value=cm;
dataGridView1->Rows[i]->Cells[3]->Value=dm;
}
if (comboBox1->SelectedIndex == 1)
{
cm=x-(i*5);
dm=cm/10;
mm=cm*10;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=cm;
dataGridView1->Rows[i]->Cells[2]->Value=dm;
dataGridView1->Rows[i]->Cells[3]->Value=mm;
}
if (comboBox1->SelectedIndex == 2)
{
dm=x-(i*5);
mm=dm*100;
cm=dm*10;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=dm;
dataGridView1->Rows[i]->Cells[2]->Value=mm;
dataGridView1->Rows[i]->Cells[3]->Value=cm;
}
}
}
}
pg. 45
PR
Ari Reza Koswara
Nim : 10872
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float F,A,tegangan;
pg. 46
printf("\nJadi tegangannya adalah = %.2f N/mm^2",tegangan);
if (tegangan>0)
{
printf("\nDisebut tegangan tarik karena bernilai positif");
}
if (tegangan<0)
{
printf("\nDisebut tegangan tekan karena bernilai negatif");
}
getch();
}
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
pg. 47
float F,m,a;
int menu;
printf("\n1.Gaya\n");
printf("2.Percepatan\n");
printf("\nPilih menu (1/2) = ");scanf("%d",&menu);
if (menu==1)
{printf("\nMenghitung nilai Gaya");
printf("\nMasukkan nilai Massa <kg> = ");scanf("%f",&m);
printf("Masukkan nilai Percepatan <m/s^2> = ");scanf("%f",&a);
F=m*a;
printf("Jadi nilai Gaya tersebut adalah = %.1f Newton\n",F);
}
else if (menu==2)
{printf("\nMenghitung nilai Percepatan");
printf("\nMasukkan nilai Gaya <F> = ");scanf("%f",&F);
printf("Masukkan nilai Massa <m> = ");scanf("%f",&m);
a=F/m;
printf("Jadi nilai percepatan tersebut adalah = %.1f m/s^2\n",a);
}
else
{printf("\nERROR CODE X00000e9");
}
getch();
}
pg. 48
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define phi 3.14
void main ()
{
float r,p,l,a,t,X,Y,Z;
int menu;
switch (menu)
{
case 1 :
pg. 49
printf(" \n masukan jari-jarinya (m) : "); scanf("%f",&r);
X=phi*r*r;
printf(" \n Jadi, luas Lingkaran adalah = %.2f m^2",X);
break;
case 2 :
printf(" \n masukan panjangnya (m) : "); scanf("%f",&p);
printf(" \n masukan lebarnya (m) : "); scanf("%f",&l);
Y=p*l;
printf(" \n Jadi, luas persegi panjang adalah = %.2f m^2",Y);
break;
case 3 :
printf(" \n masukan alasnya (m) : "); scanf("%f",&a);
printf(" \n masukan tinggi (m) : "); scanf("%f",&t);
Z=a*t;
printf(" \n Jadi, luas jajaran genjang adalah = %.2f m^2",Z);
break;
default :
printf(" \n ERORRRRR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
getch();
}
pg. 50
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define phi 3.14
void main ()
{
float R,p,l,t,r,T,A,B,C;
int menu;
switch (menu)
{
case 1 :
printf(" \n Masukkan panjang rusuknya (m) : "); scanf("%f",&R);
A=R*R*R;
printf(" \n Jadi, volume kubus tersebut adalah = %.2f m^3",A);
break;
case 2 :
printf(" \n Masukkan panjang nya (m) : "); scanf("%f",&p);
printf(" \n Masukkan lebar nya (m) : "); scanf("%f",&l);
printf(" \n Masukkan tinggi nya (m) : "); scanf("%f",&t);
B=p*l*t;
printf(" \n Jadi, volume balok tersebut adalah = %.2f m^3",B);
break;
case 3 :
printf(" \n Masukkan jari-jarinya (m) : "); scanf("%f",&r);
printf(" \n Masukkan tinggi nya (m) : "); scanf("%f",&T);
C=phi*r*r*T;
printf(" \n Jadi, volume tabung tersebut adalah = %.2f m^3",C);
break;
default :
printf(" \n ERRORRRRRRRRRRRRRR!!!!!!!!!!!!!!!!!!!!");
}
getch();
}
pg. 51
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float m,g,h0,ht,inter,h,Ep;
int n,i;
n=(ht-h0)/inter;
g=10;
for (i=0;i<=n;i=i+1)
pg. 52
{
h=h0+(i*inter);
Ep=m*g*h;
printf("\n | %5d | %8.1f | %8.1f |",i+1,h,Ep);
}
printf("\n ==========================================");
getch();
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float sekon,a,jarak,VT,VoAW,VoAK,Vnol;
int i,n,inter;
pg. 53
printf(" Input waktu yang diinginkan <t> = ");scanf("%f",&sekon);
n=(VoAK-VoAW)/inter;
for(i=0;i<=n;i=i+1)
{
Vnol=VoAW+(i*inter);
a=(VT-Vnol)/sekon;
jarak=(Vnol*sekon)+(0.5*a*sekon*sekon);
if(a>0)
printf("\n | %6d | %6.2f | %6.2f | %6.2f | Dipercepat
|",i+1,Vnol,jarak,a);
else if(a<0)
printf("\n | %6d | %6.2f | %6.2f | %6.2f | Diperlambat
|",i+1,Vnol,jarak,a);
else
printf("\n | %6d | %6.2f | %6.2f | %6.2f | Konstan
|",i+1,Vnol,jarak,a);
}
printf("\n ====================================================================");
getch();
}
pg. 54
Berikut Program Visual nya :
if (listBox1->SelectedIndex == 1) phi=3.14;
if (listBox1->SelectedIndex == 2) phi=22/7;
if (comboBox1->SelectedIndex == 0) r=5;
if (comboBox1->SelectedIndex == 1) r=10;
if (comboBox1->SelectedIndex == 2) r=15;
if (comboBox1->SelectedIndex == 3) r=20;
if (comboBox1->SelectedIndex == 4) r=25;
if (comboBox1->SelectedIndex == 5) r=30;
if (radioButton1->Checked) t=1;
if (radioButton2->Checked) t=3;
if (radioButton3->Checked) t=5;
if (radioButton4->Checked) t=7;
if (radioButton5->Checked) t=9;
if (radioButton6->Checked) t=11;
if (r==0)
{MessageBox::Show("Input jari-jari tidak boleh kosong !!");
}
else if (t==0)
{MessageBox::Show("Input tinggi tabung tidak boleh kosong
!!");
}
else if (phi==0)
{MessageBox::Show("Input phi tidak boleh kosong !!");
}
pg. 55
else
{hasil=phi*r*r*t;
textBox1->Text = Convert::ToString(hasil);
}
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
comboBox1->SelectedIndex=-1;
listBox1->SelectedIndex=-1;
textBox1->Text="";
radioButton1->Checked=false;
radioButton2->Checked=false;
radioButton3->Checked=false;
radioButton4->Checked=false;
radioButton5->Checked=false;
radioButton6->Checked=false;
pg. 56
comboBox3->SelectedIndex=-1;
label5->Text="xxxx";
label7->Text="xxxx";
label8->Text="xxxx";
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
float a,b,c,D,status;
if (comboBox1->SelectedIndex == 1) a=-3;
if (comboBox1->SelectedIndex == 2) a=-2;
if (comboBox1->SelectedIndex == 3) a=-1;
if (comboBox1->SelectedIndex == 4) a=1;
if (comboBox1->SelectedIndex == 5) a=2;
if (comboBox1->SelectedIndex == 6) a=3;
if (comboBox1->SelectedIndex == 7) a=4;
if (comboBox2->SelectedIndex == 1) b=1;
if (comboBox2->SelectedIndex == 2) b=2;
if (comboBox2->SelectedIndex == 3) b=3;
if (comboBox2->SelectedIndex == 4) b=4;
if (comboBox2->SelectedIndex == 5) b=5;
if (comboBox2->SelectedIndex == 6) b=6;
if (comboBox2->SelectedIndex == 7) b=7;
if (comboBox3->SelectedIndex == 1) c=1;
if (comboBox3->SelectedIndex == 2) c=2;
if (comboBox3->SelectedIndex == 3) c=3;
if (comboBox3->SelectedIndex == 4) c=4;
if (comboBox3->SelectedIndex == 5) c=5;
if (comboBox3->SelectedIndex == 6) c=6;
if (comboBox3->SelectedIndex == 7) c=7;
if (a==0)
MessageBox::Show("Input a !!");
else if (b==0)
MessageBox::Show("Input b !!");
else if (c==0)
MessageBox::Show("Input c !!");
else
{
D=(b*b)-4*a*c;
label5->Text = Convert::ToString(D);
if (a>0)
label7->Text = "Terbuka ke atas";
if (a<0)
label7->Text = "Terbuka ke bawah";
if (D>0)
label8->Text = "Memotong sb x di dua titik";
if (D<0)
label8->Text = "Tidak mengenai sumbu x";
if (D==0)
label8->Text = "Menyinggung sb x di satu titik";
pg. 57
}
pg. 58
if(textBox1->Text!="" && textBox2->Text=="" && textBox3->Text=="")
{
KPH=Convert::ToDouble(textBox1->Text);
KPS=KPH/3600;
MPS=(KPH*1000)/3600;
textBox2->Text = Convert::ToString(KPS);
textBox3->Text = Convert::ToString(MPS);
}
if(textBox1->Text=="" && textBox2->Text!="" && textBox3->Text=="")
{
KPS=Convert::ToDouble(textBox2->Text);
KPH=KPS*3600;
MPS=KPS*1000;
textBox1->Text = Convert::ToString(KPH);
textBox3->Text = Convert::ToString(MPS);
}
if(textBox1->Text=="" && textBox2->Text=="" && textBox3->Text!="")
{
MPS=Convert::ToDouble(textBox3->Text);
KPH=(MPS*3600)/1000;
KPS=MPS/1000;
textBox1->Text = Convert::ToString(KPH);
textBox2->Text = Convert::ToString(KPS);
}
}
pg. 59
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
textBox1->Text="";
textBox2->Text="";
textBox3->Text="";
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e)
{
float K,F,X;
pg. 60
Berikut Program Visual nya :
if (listBox1->SelectedIndex == 1) a1=10;
if (listBox1->SelectedIndex == 2) a1=15;
if (listBox1->SelectedIndex == 3) a1=20;
if (listBox2->SelectedIndex == 1) a2=30;
if (listBox2->SelectedIndex == 2) a2=35;
if (listBox2->SelectedIndex == 3) a2=40;
if (listBox3->SelectedIndex == 1) b=2;
pg. 61
if (listBox3->SelectedIndex == 2) b=3;
if (listBox3->SelectedIndex == 3) b=4;
if (radioButton1->Checked) EN=10;
if (radioButton2->Checked) EN=12;
if (listBox1->SelectedIndex ==-1||listBox1->SelectedIndex
==0)
MessageBox::Show("Input Suku Pertama Awal !!");
else if(listBox2->SelectedIndex ==-1||listBox2->SelectedIndex ==0)
MessageBox::Show("Input Suku Pertama Akhir !!");
else if (radioButton1->Checked==false&&radioButton2-
>Checked==false)
MessageBox::Show("Input ke-n nya !!");
else if(listBox3->SelectedIndex ==-1||listBox3->SelectedIndex ==0)
MessageBox::Show("Input Beda !!");
else
{
n=(a2-a1)/5;
dataGridView1->RowCount=n+1;
for(i=0;i<=n;i++)
{
no=i+1;
a=a1+(i*5);
Un=a+(EN-1)*b;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=a;
dataGridView1->Rows[i]->Cells[2]->Value=Un;
}
}
}
pg. 62
Berikut Program Visual nya :
if (listBox1->SelectedIndex == 1) d1=100;
if (listBox1->SelectedIndex == 2) d1=200;
if (listBox1->SelectedIndex == 3) d1=300;
if (listBox2->SelectedIndex == 1) d2=400;
if (listBox2->SelectedIndex == 2) d2=500;
if (listBox2->SelectedIndex == 3) d2=600;
if (radioButton1->Checked) EN=100;
pg. 63
if (radioButton2->Checked) EN=200;
for(i=0;i<=n;i++)
{
no=i+1;
d=d1+(i*20);
CS=(3.14*d*EN)/1000;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=d;
dataGridView1->Rows[i]->Cells[2]->Value=CS;
pg. 64
PR
Gatot Yudhanto
Nim : 12283
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float P,F,A;
pg. 65
printf("Masukkan Beban (N)=");
scanf("%f",&F);
printf("Masukkan Luas Permukaan (mm^2)=");
scanf("%f",&A);
P=F/A;
if(P>=100)
printf("Benda Patah");
if(P<100)
printf("Benda Tidak Patah");
getch();
2. Program Matematika
pg. 66
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
void main ()
{
float LP,V,K,p,l,t;
int kode;
printf("Matematika\n");
printf("Nama=Gatot \nNim= 12283\n");
printf(".................. \n\n");
printf("Pilihan Kode\n");
printf("1. Menentukan Luas Permukaan Balok\n");
printf("2. Menentukan Volune Balok \n");
printf("3. Menentukan Keliling Balok \n\n");
if(kode==1)
{ printf("Luas Permukaan Balok\n");
printf("\nMasukkan nilai p= ");
scanf("%f",&p);
printf("\nMasukkan nilai l= ");
scanf("%f",&l);
printf("\nMasukkan nilai t= ");
scanf("%f",&t);
LP= 2*((p*l)+(p*t)+(l*t));
printf("Hasil Luas Permukaan Balok= %.2f",LP);
}
else if(kode==2)
{ printf("Volume Balok\n");
printf("\nMasukkan nilai p= ");
scanf("%f",&p);
printf("\nMasukkan nilai l= ");
scanf("%f",&l);
printf("\nMasukkan nilai t= ");
scanf("%f",&t);
V=p*l*t;
printf("Hasil Volume Balok= %.2f",V);
}
else if(kode==3)
{ printf("Keliling Balok\n");
printf("\nMasukkan nilai p= ");
scanf("%f",&p);
printf("\nMasukkan nilai l= ");
scanf("%f",&l);
printf("\nMasukkan nilai t= ");
scanf("%f",&t);
pg. 67
K=4*(p+l+t);
printf("Hasil Keliling Balok= %.2f",K);
}
else
printf("Kode Salah");
getch();
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float h,v,t,v0;
int menu,g;
g=10;
pg. 68
printf("====================================\n\n");
printf("Pilihan Menu :\n1. Menghitung Kecepatan Di Permukaan Tanah (v)\n2.
Menghitung Lama Benda Sampai Tanah (t)");
printf("\nPilih Menu (1 atau 2) : ");scanf("%d",&menu);
if(menu==1)
{
printf("\nMenghitung Kecepatan Di Permukaan Tanah (v)\n");
printf("-------------------------------------------\n");
printf("Masukkan Tinggi Dari Permukaan Tanah (h) : ");scanf("%f",&h);
v0=2*g*h;
v=sqrt(v0);
printf("Hasilnya adalah : %.3f", v);
}
else if(menu==2)
{
printf("\nMenghitung Lama Benda Sampai Tanah (t)\n");
printf("------------------------------------------\n");
printf("Masukkan Tinggi Dari Permukaan Tanah (h) : ");scanf("%f",&h);
t=sqrt((2*h/g));
printf("Hasilnya adalah : %.3f", t);
}
else
printf("\nNomor Salah");
getch();
}
pg. 69
Berikut Program Console nya :
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float v,s,t,a,vt,v0;
int menu;
switch(menu)
{
case 1:
printf("\nMenghitung Kecepatan (v) GLB\n");
printf("--------------------------------\n");
printf("Masukkan Jarak (s) : ");scanf("%f",&s);
printf("Masukkan Waktu (t) : ");scanf("%f",&t);
v=s/t;
printf("Hasilnya adalah : %.3f",v);
pg. 70
break;
case 2:
printf("\nMenghitung Kecepatan Akhir (vt) GLBB\n");
printf("----------------------------------------\n");
printf("Masukkan Kecepatan Awal (v0) : ");scanf("%f",&v0);
printf("Masukkan Waktu (t) : ");scanf("%f",&t);
printf("Masukkan Percepatan (a) : ");scanf("%f",&a);
vt=a*t+v0;
printf("Hasilnya adalah : %.3f",vt);
break;
default:
printf("\nInput Tidak Dikenal");
}
getch();
}
void main()
{
float da,dk,inter,dt,V,L;
int i,n;
n=(dk-da)/inter;
for(i=0;i<=n;i=i+1)
{
dt=da+(i*inter); V=dt*dt*dt; L=dt*dt*6;
printf("\n |%2d | %6.2f | %6.2f |%6.2f |",i+1,dt,V,L);
}
getch();
}
pg. 72
Berikut Program Console nya :
#include <stdio.h>
#include <conio.h>
void main ()
{
int Kode;
printf("\n\n\nPilihan Usaha");
printf("\n 1. Searah dengan arah benda");
printf("\n 2. Berlawanan dengan arah benda");
printf("\n 3. Tidak menyebabkan perpindahan");
switch (Kode)
case 1 :
printf("\nUsaha Bernilai POSITIF");
break;
case 2 :
printf("\nUsaha Bernilai NEGATIF");
break;
case 3 :
printf("\nUsaha Bernilai NOL");
break;
default :
printf("\n\nMaaf, Anda Memasukkan Kode Yang Salah");
printf("\n\n Coba Ulangi Lagi");
getch ();
pg. 73
7. Program Garvitasi Vertikal Ke Bawah
float vo,g,t,vt;
if (comboBox1->SelectedIndex == 0) vo=2;
if (comboBox1->SelectedIndex == 1) vo=4;
if (comboBox1->SelectedIndex == 2) vo=6;
if (listBox1->SelectedIndex == 0) t=5;
if (listBox1->SelectedIndex == 1) t=10;
if (listBox1->SelectedIndex == 2) t=15;
if (radioButton1->Checked) g=9.8;
if (radioButton2->Checked) g=10;
pg. 74
if (vo==0)
MessageBox::Show("Masukan vo!!!");
else if (t==0)
MessageBox::Show("Masukan t!!!");
else if (g==0)
MessageBox::Show("Masukan g!!!");
else
{
vt=vo+(t*g);
label5->Text = Convert::ToString(vt);
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e)
{
comboBox1->SelectedIndex=-1;
listBox1->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
label5->Text="xxxxx";
}
private: System::Void button2_Click_1(System::Object^ sender, System::EventArgs^ e)
{
comboBox1->SelectedIndex=-1;
listBox1->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
label5->Text="xxxx";
}
private: System::Void button3_Click_1(System::Object^ sender, System::EventArgs^ e)
{
Close();
}
pg. 75
Berikut Program Visual nya :
if (comboBox1->SelectedIndex == 0) vo=10;
if (comboBox1->SelectedIndex == 1) vo=20;
if (comboBox1->SelectedIndex == 2) vo=30;
if (comboBox1->SelectedIndex == 3) vo=40;
if (listBox1->SelectedIndex == 1) tt=30;
if (listBox1->SelectedIndex == 2) tt=45;
if (listBox1->SelectedIndex == 3) tt=60;
if (listBox1->SelectedIndex == 4) tt=90;
if (radioButton1->Checked) t=1;
if (radioButton2->Checked) t=2;
if (radioButton3->Checked) t=3;
if (radioButton4->Checked) t=4;
if (radioButton5->Checked) t=5;
if (radioButton6->Checked) t=6;
if (radioButton7->Checked) t=7;
if (radioButton8->Checked) t=8;
if (radioButton9->Checked) t=9;
pg. 76
if (comboBox1->SelectedIndex == -1)
MessageBox::Show("Input Vo tidak boleh kosong!!");
else if (listBox1->SelectedIndex == -1)
MessageBox::Show("Input Sudut tidak boleh kosong!!");
else if (t==0)
MessageBox::Show("Input t tidak boleh
kosong!!");
else
{
tp=(vo*(sin(tt/57.2958)))/10;
h=((vo*t*(sin(tt/57.2958)))-(5*t*t));
hm=(vo*vo*(sin(tt/57.2958))*(sin(tt/57.2958)))/20;
{
if(h>0)
label6->Text = Convert::ToString(h);
else if(h<0)
label6->Text = "0";
else
label6->Text = "xxxxx";
}
{
if(t<tp)
label5->Text = "naik";
else if(tp==t)
label5->Text = "puncak";
else if(t>tp)
label5->Text = "turun";
else if(h<0)
label5->Text = "menyentuh tanah";
else
label5->Text = "xxxxx";
}
}
}
private: System::Void button2_Click_1(System::Object^ sender, System::EventArgs^ e)
{
comboBox1->SelectedIndex=-1;
listBox1->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
radioButton3->Checked=false;
radioButton4->Checked=false;
radioButton5->Checked=false;
radioButton6->Checked=false;
radioButton7->Checked=false;
radioButton8->Checked=false;
radioButton9->Checked=false;
label5->Text = "xxxxx";
label6->Text = "xxxxx";
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e)
pg. 77
{
Close();
}
9. Program Gaya
float f,m,a;
if(textBox1->Text=="" && textBox2->Text=="" && textBox3-
>Text=="")
MessageBox::Show("Input Tidak Boleh Kosong !!!");
if(textBox1->Text!="" && textBox2->Text!="" && textBox3-
>Text!="")
MessageBox::Show("Input Tidak Boleh Semua !!!");
if(textBox1->Text!="" && textBox2->Text=="" && textBox3-
>Text=="")
MessageBox::Show("Input m atau a !!!");
if(textBox1->Text=="" && textBox2->Text!="" && textBox3-
>Text=="")
MessageBox::Show("Input f atau a !!!");
pg. 78
if(textBox1->Text=="" && textBox2->Text=="" && textBox3-
>Text!="")
MessageBox::Show("Input f atau m !!!");
if(textBox1->Text=="" && textBox2->Text!="" && textBox3-
>Text!="")
{
m=Convert::ToDouble(textBox2->Text);
a=Convert::ToDouble(textBox3->Text);
f=a*m;
textBox1->Text = Convert::ToString(f);
}
if(textBox1->Text!="" && textBox2->Text=="" && textBox3-
>Text!="")
{
f=Convert::ToDouble(textBox1->Text);
a=Convert::ToDouble(textBox3->Text);
m=f/a;
textBox2->Text = Convert::ToString(m);
}
if(textBox1->Text!="" && textBox2->Text!="" && textBox3-
>Text=="")
{
f=Convert::ToDouble(textBox1->Text);
m=Convert::ToDouble(textBox2->Text);
a=f/m;
textBox3->Text = Convert::ToString(a);
}
}
private: System::Void button2_Click_1(System::Object^ sender, System::EventArgs^ e)
{
textBox1->Text="";
textBox2->Text="";
textBox3->Text="";
}
pg. 79
Berikut Program Visual nya :
pg. 80
if(textBox1->Text!="" && textBox2->Text=="" && textBox3-
>Text!="")
{
w=Convert::ToDouble(textBox1->Text);
s=Convert::ToDouble(textBox3->Text);
f=2*w/s;
textBox2->Text = Convert::ToString(f);
}
if(textBox1->Text=="" && textBox2->Text!="" && textBox3-
>Text!="")
{
f=Convert::ToDouble(textBox2->Text);
s=Convert::ToDouble(textBox3->Text);
w=(f*s)/2;
textBox1->Text = Convert::ToString(w);
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
textBox1->Text="";
textBox2->Text="";
textBox3->Text="";
}
private: System::Void button3_Click_1(System::Object^ sender, System::EventArgs^ e)
{
Close();
}
private: System::Void button2_Click_1(System::Object^ sender, System::EventArgs^ e)
{
textBox1->Text="";
textBox2->Text="";
textBox3->Text="";
}
pg. 81
Berikut Program Visual nya :
if (radioButton9->Checked==false&&radioButton8-
>Checked==false&&radioButton7->Checked==false&&radioButton6-
>Checked==false&&radioButton5->Checked==false&&radioButton4-
>Checked==false&&radioButton3->Checked==false&&radioButton2-
>Checked==false&&radioButton1->Checked==false)
{MessageBox::Show("Pilih jari jari awal ");}
else if(textBox2->Text=="")
{MessageBox::Show("Tentukan jari jari akhir !!!");}
else if (comboBox1->SelectedIndex==-1)
{MessageBox::Show("Interval harus dipilih !!");}
else
{
nakr=Convert::ToDouble(textBox2->Text);
pg. 82
if (radioButton3->Checked) nawr= -1;
if (radioButton4->Checked) nawr= 0;
if (radioButton5->Checked) nawr= 1;
if (radioButton6->Checked) nawr= 2;
if (radioButton7->Checked) nawr= 3;
if (radioButton8->Checked) nawr= 5;
if (radioButton9->Checked) nawr= 10;
if (comboBox1->SelectedIndex == 0) intv= 1;
if (comboBox1->SelectedIndex == 1) intv= 2;
if (comboBox1->SelectedIndex == 2) intv= 3;
if (comboBox1->SelectedIndex == 3) intv= 4;
if (comboBox1->SelectedIndex == 4) intv= 5;
if (nawr>=nakr)
MessageBox::Show("Jari jari awal < Jari jari
akhir !!");
else
{n=(nakr-nawr)/intv;
dataGridView1->RowCount=n+1;
for (i=0;i<=n;i=i+1)
{
No=(i+1);
r=nawr+(i*intv);
lb=((88*r*r)/7);
vb=((88*r*r)/21);
dataGridView1->Rows[i]->Cells[0]->Value=No;
dataGridView1->Rows[i]->Cells[1]->Value=r;
dataGridView1->Rows[i]->Cells[2]->Value=lb;
dataGridView1->Rows[i]->Cells[3]->Value=vb;
}
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e)
{
dataGridView1->RowCount=1;
dataGridView1->Rows[0]->Cells[0]->Value="";
dataGridView1->Rows[0]->Cells[1]->Value="";
dataGridView1->Rows[0]->Cells[2]->Value="";
dataGridView1->Rows[0]->Cells[3]->Value="";
radioButton1->Checked=false;
radioButton2->Checked=false;
radioButton3->Checked=false;
radioButton4->Checked=false;
pg. 83
radioButton5->Checked=false;
radioButton6->Checked=false;
radioButton7->Checked=false;
radioButton8->Checked=false;
radioButton9->Checked=false;
comboBox1->SelectedIndex=-1;
textBox2->Text="";
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e)
{
Close();
}
pg. 84
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
int i,n,No;
float nawx,nakx,intvx,nawy,intvy,x,y,m;
if (comboBox1->SelectedIndex==-1)
MessageBox::Show("Input sumbu X awal !!");
else if(comboBox2->SelectedIndex==-1)
MessageBox::Show("Input sumbu X akhir !!!");
else if(radioButton6->Checked==false&&radioButton5-
>Checked==false&&radioButton4->Checked==false&&radioButton3-
>Checked==false&&radioButton2->Checked==false&&radioButton1->Checked==false)
{MessageBox::Show("Input interval sumbu X !!");}
else if (comboBox2->SelectedIndex==-1)
MessageBox::Show("Input sumbu Y awal !!");
else if (listBox1->SelectedIndex ==-1)
MessageBox::Show("Input interval Y !!");
else
{
if (comboBox1->SelectedIndex == 0) nawx= -3;
if (comboBox1->SelectedIndex == 1) nawx= -2;
if (comboBox1->SelectedIndex == 2) nawx= -1;
if (comboBox1->SelectedIndex == 3) nawx= 0;
if (comboBox1->SelectedIndex == 4) nawx= 1;
if (comboBox1->SelectedIndex == 5) nawx= 3;
if (comboBox1->SelectedIndex == 6) nawx= 5;
if (comboBox1->SelectedIndex == 7) nawx= 7;
if (comboBox2->SelectedIndex == 0) nakx= 1;
if (comboBox2->SelectedIndex == 1) nakx= 2;
if (comboBox2->SelectedIndex == 2) nakx= 3;
if (comboBox2->SelectedIndex == 3) nakx= 4;
if (comboBox2->SelectedIndex == 4) nakx= 5;
if (comboBox2->SelectedIndex == 5) nakx= 6;
if (comboBox2->SelectedIndex == 6) nakx= 7;
if (comboBox2->SelectedIndex == 7) nakx= 8;
if (radioButton1->Checked) intvx= 1;
if (radioButton2->Checked) intvx= 2;
if (radioButton3->Checked) intvx= 3;
if (radioButton4->Checked) intvx= 4;
if (radioButton5->Checked) intvx= 5;
if (radioButton6->Checked) intvx= 10;
if (listBox1->SelectedIndex == 1) intvy=2;
if (listBox1->SelectedIndex == 2) intvy=3;
pg. 85
if (listBox1->SelectedIndex == 3) intvy=4;
if (listBox1->SelectedIndex == 4) intvy=5;
if (nawx>nakx)
MessageBox::Show("Nilai X awal harus lebih
besar dari nilai X akhir!!");
if (intvx==intvy)
{ MessageBox::Show("Nilai interval X tidak boleh
sama dengan interval Y !!");
else
{n=(nakx-nawx)/intvx;
dataGridView1->RowCount=n+1;
for (i=0;i<=n;i=i+1)
{
No=(i+1);
dataGridView1->Rows[i]->Cells[0]->Value=No;
x=nawx+(i*intvx);
dataGridView1->Rows[i]->Cells[1]->Value=x;
y=nawy+(i*intvy);
dataGridView1->Rows[i]->Cells[2]->Value=y;
m=x/y;
dataGridView1->Rows[i]->Cells[3]->Value=m;
if (m>0)
dataGridView1->Rows[i]->Cells[4]->Value="gradien
garis positif";
if (m<0)
dataGridView1->Rows[i]->Cells[4]->Value="gradien
garis negatif";
if (m==0)
dataGridView1->Rows[i]->Cells[4]->Value="tidak
memiliki gradien ";
}
}
}
}
private: System::Void button2_Click_1(System::Object^ sender, System::EventArgs^ e)
{
dataGridView1->RowCount=1;
dataGridView1->Rows[0]->Cells[0]->Value="";
dataGridView1->Rows[0]->Cells[1]->Value="";
dataGridView1->Rows[0]->Cells[2]->Value="";
dataGridView1->Rows[0]->Cells[3]->Value="";
dataGridView1->Rows[0]->Cells[4]->Value="";
comboBox1->SelectedIndex=-1;
comboBox2->SelectedIndex=-1;
comboBox3->SelectedIndex=-1;
pg. 86
listBox1->SelectedIndex=-1;
radioButton1->Checked=false;
radioButton2->Checked=false;
radioButton3->Checked=false;
radioButton4->Checked=false;
radioButton5->Checked=false;
radioButton6->Checked=false;
}
private: System::Void button3_Click_1(System::Object^ sender, System::EventArgs^ e)
{
Close();
}
pg. 87