Thursday, November 10, 2011

Looping/Perulangan (Nested For)

create an output like this..


This is a listing program :


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


main()

{
int a,b;
clrscr();

for(a=1;a<=5;a++)
{
   printf("\n");
   for(b=a;b<=5;b++)
   cout<<a;
   }
getch();
}


Enjoy it...if any one does not understand please ask by leaving a comment ..
and do not forget to follow our blog ... ^ _ ^

ReadMore...

Looping ( FOR )

..create an output like this..

This is a program listing :



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

main()

{

int a;
clrscr();
for(a=1;a<=10;a++)
cout<<a<<endl;

getch();
}

Enjoy it..if any one does not understand please ask by leaving a comment ..
and do not forget to follow our blog ... ^ _ ^

ReadMore...

Wednesday, November 2, 2011

IF Fuction (Visual Basic)


Use: Label, Textbox, Option, Frame and command buttons.


Terms of Problem:

When the selected item code item name and price will appear.


When the inputted number of buy and clicked enter then the total price will appear.

When the money to pay the money back even typed will appear.


This is the listing :





Private Sub ckobar_Click()
If ckobar.Text = "EMB" Then
    txtnabar.Text = "EMBER"
    txtharga.Text = 15000
ElseIf ckobar.Text = "PNC" Then
    txtnabar.Text = "PANCI"
    txtharga.Text = 75000
Else
    txtnabar.Text = "SAPU"
    txtharga.Text = 10000
End If
End Sub

Private Sub cmdinput_Click()
txtnapem.Text = ""
ckobar.Text = "-PiliH-"
txtnabar.Text = ""
txtharga.Text = ""
txtfasilitas.Text = ""
optdelivery = Clear
optditempat = Clear
txtjumbel.Text = ""
txttotbay.Text = ""
txttotbay.Enabled = False
txtubay.Text = ""
txtukem.Text = ""
txtukem.Enabled = False
txtnapem.SetFocus
End Sub

Private Sub cmdkeluar_Click()
If MsgBox("Yakin lo mau Keluar ?? Serius ??", 36, "Peringatan") = vbYes Then
End
End If
End Sub

Private Sub Form_Load()
ckobar.AddItem ("EMB")
ckobar.AddItem ("PNC")
ckobar.AddItem ("SPU")
'cmdinput.SetFocus
End Sub

Private Sub optdelivery_Click()
txtfasilitas.Text = 15000
txtjumbel.SetFocus

End Sub

Private Sub optditempat_Click()
txtfasilitas.Text = 0
txtjumbel.SetFocus

End Sub


Private Sub txtjumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    txttotbay.Text = Val(txtharga) * Val(txtjumbel) + Val(txtfasilitas)
    txtubay.SetFocus
End If
End Sub


Private Sub txtubay_Change()
txtukem.Text = Val(txtubay) - Val(txttotbay)
End Sub


Enjoy it..^_^
if any one does not understand please ask and leave a comment ..^_^


ReadMore...