Paper class for Pemrograman II

source code c++

a = 2
a = 4
a = 6
b = 4
b = 2
b = 0

//—————————————————
#pragma hdrstop
#include < iostream.h >
#include < conio.h >

//—————————————————
#pragma argsused
int main ( int argc, char* argv[] )
{
int a=2, b=4;
for ( int i=1; i<=6; i++ )
{
if ( i>3 )
{cout<<”b = “ << b << endl ;
b=b-2 ;
}
else
{cout<<”a = “ << a << endl ;
a=a+2 ;
}
}
getch();
return 0;
}

Iklan

Papper class for Program Basis Data

Source codenya membuat pengamanan karakter:

Private Sub cmddec_Click()
sinp = txtinput.Text
sout = “”
For p = 1 To Len(sinp) Step 1
sc = Mid(sinp, p, 1)
nc = Asc(sc) – 3
sout = sout + Chr(nc)
Next p
txtoutput.Text = sout
End Sub

txtoutput.Text = “”

Private Sub cmdenc_Click()
sinp = txtinput.Text
sout = “”
For p = 1 To Len(sinp) Step 1
sc = Mid(sinp, p, 1)
nc = Asc(sc) + 3
sout = sout + Chr(nc)
Next p
txtoutput.Text = sout
End Sub

txtinput.Text = “”

Private Sub cmdexit_Click()
End
End Sub

Private Sub cmdclear_Click()

Private Sub Form_Load()
txtoutput.Enabled = False
End Sub

Mata kuliah C++ konversi angka

#include <vcl.h>
looping
====================

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

//—————————————-

#pragma argsused
int main(int argc, char* argv[])
{
int b=2,c=4;
for( int a=5;a<=7;a=a+2)
{cout<<“a=” <<a<<endl;
cout<<“b=” <<b<<endl;
cout<<“c=” <<c<<endl;
b=b+2;
c=c+3;}
getch();
return 0;
}

hasilnya

a=5
b=2
c=4
a=7
b=4
c=7

#include <vcl.h>
#pragma hdrstop
#include <iostream.h>
#include <conio.h>

//————————————-

#pragma argsused
int main(int argc, char* argv[])
{
int q=10,z=5;
for( int r=2;r<=5;r=r+3)
{cout<<“q=”<<q<<endl;
cout<<“r=”<<r<<endl;
cout<<“z=”<<z<<endl;
q=q-3;
z=z+3;}
getch();
return 0;
}

hasilnya

q=10
r=2
z=5
q=7
r=5
z=8

#include <vcl.h>
#pragma hdrstop
#include <iostream.h>
#include <conio.h>

//————————————-

#pragma argsused
int main(int argc, char* argv[])
{
int p=5,z=10;
for( int r=2;r<=5;r=r+2)
{cout<<“p=”<<p<<endl;
cout<<“r=”<<r<<endl;
cout<<“z=”<<z<<endl;
p=p-1;
z=z-6;}
getch();
return 0;
}

hasilnya

p=5
q=2
r=10
p=4
q=4
r=4