MARI KITA BERKREASI KAWANDZ

buku taMu


ShoutMix chat widget

Anda berminat buat Buku Tamu seperti ini?
Klik di sini

Sabtu, 25 Desember 2010

Contoh Program Function

Program Menentukan Bilangan Terkecil

Program Fungsi;
uses wincrt;
function kecil (A,B : integer): integer;
begin
if A
kecil := A
else
kecil := B;
end;
var
A,B: integer;
begin
clrscr;
write('Nilai Bilangan 1 = '); readln(A);
write('Nilai Bilangan 2 = '); readln(B);
writeln;
write('Bilangan Terkecil = ', kecil (A,B):5);
readln;
end.

HASIL PROGRAM



 





Contoh Program Pascal Array

Menentukan Bilangan Prima Dari Hasil Perkalian Dua Bilangan

Program Mencari_Bilangan_Prima_dari perkalian_dua_bilangan;
Uses winCrt;
Var
Prima : Array[1..100] of Integer;
i,j,a,b,c : Integer;
bil : Integer;
Begin
ClrScr;
write('Masukkan angka 1 = ');readln(a);
write('Masukkan angka 2 = ');readln(b);
c:=a*b;
writeln('Hasil= ',c);
For i := 2 to c Do
Begin
Prima[i]:=i;
For j:= 2 to i-1 Do
Begin
bil := (i mod j);
If bil = 0 then Prima[i]:=0;
End;
If Prima[i] <> 0 Then Write(Prima[i],' ');
End;
Readln;
end.

HASIL PROGRAM 

Sabtu, 18 Desember 2010

PROGRAM PERMUTASI DAN KOMBINASI

program pascal dibawah ini:

program kombinasi_permutasi;
uses wincrt;
var
fn,fk,fn_k,Kombinasi,permutasi:real;
i,n,k:integer;
begin
writeln('MENGHITUNG PERMUTASI DAN KOMBINASI:') ;
write('Masukkan bilangan n =');readln(n);
write('Masukkan bilangan k =');readln(k);
fn:=1;
fk:=1;
fn_k:=1;
for i:= 2 to n do
fn:=fn*i;
for i := 2 to k do
fk:=fk*i;
for i:= 2 to (n-k) do
fn_k:=fn_k*i;
kombinasi:=fn/(fk*fn_k);
permutasi:=fn/(fn_k);
writeln(n,' Kombinasi ',k, ' = ',Kombinasi:0:0);
writeln(n,' Permutasi ',k, ' = ',Permutasi:0:0);
end.

hasil dari program diatas akan menghasilkan












SMOGA DAPAT MEMBANTU

Senin, 08 November 2010

Contoh Program PAscal Menentukan Faktorial

program menghitung_faktorial;
uses wincrt;
var
i,n,fak: integer;

begin
writeln ('program menghitung faktorial');
write('n= '); readln(n);
fak:= 1;
for i := n downto 1 do
fak:=fak*i;
writeln(n,'!= ',fak);
readln;
end.

PROSES












HASIL :














Algoritma Menghitung Nilai Faktorial :

  1. Tentukan angka
  2. Tuliskan rumus fak*i maka i = n down to 1 
  3. Masukkan angka pada rumus
  4. Hasil.

Contoh Program Pascal Case of Menentukan Indeks Nilai

Program Pascal menentukan indeks nilai


program NA_CASE_OF ;
uses wincrt;
var
n,na : integer;
begin
writeln ('masukkan nilai yang didapat'); readln (n);
na:=n div 20;
case na of
1: write ('indeks nilai : E');
2: write ('indeks nilai : D');
3: write ('indeks nilai : C');
4: write ('indeks nilai : B');
5: write ('indeks nilai : A');
end;
end.

Proses :












dari proses diatas akan menghasilkan gambar :

















FLOWCHAT dari Menentukan Indeks Nilai :


Sabtu, 30 Oktober 2010

 

COWOK" KERENK,,,

CONTOH if - then - else

ALGORITMA PENENTUAN HARI :

1. Tentukan hari
2. Tentukan kode hari
3. Masukkan kode hari
4. Jika angka 1= hari senin
5. Jika angka 2 = hari selasa
6. Jika angka 3 = hari rabu
7. Jika angka 4 = hari kamis
8. Jika angka 5 = hari jum’at
9. Jika angka 6 = hari sabtu
10. Jika angka 7 = hari minggu
11. Hasil


GAMBAR FLOWCHAT NYA : 





























Sabtu, 16 Oktober 2010

TIPE DATA

1. Tipe sederhana
Tipe sederhana disebut dengan tipe data scalar, yang biasa diartikan bahwa dalam sebuah perubahan hanya dimungkinkan untuk menyimpan sebuah nilai data, dan tipe sderhana terbagi menjadi dua, yaitu tipe ordinal dan tipe real

a. Tipe ordinal
karakteristiknya adalah :
• Semua kemungkinan nilai dari suatu tipe ordinal merupakan himpunan berurutan (ordered set). Dan setiap nilai berkaitan dengan ordinalitasnya.
• Fungsi standard ord dapat diterapkan dalam sembarang tipe ordinal untik mengetahui ordinalitasnya
• Fungsi standard pred dapat diterapkan untuk mengetahui pendahuluannya
• Fungsi standard succ dapat diterapkan untuk mengetahui penerusnya.
Turbo pascal memiliki 7 tipe ordinal standard, yaitu integer, shortint, longint, byte, word, boolen dan char
i. Tipe integer adalah tipe data yang merupakan bilangan bulat yang mana nilai nya tidak mempunyai titik decimal. Ada 5 data yang termasuk adalam kelompok ini, yaitu integer, shortint, longint, byte, dan word

ii. Tipe data Boolean, Tipe data ini digunakan untuk pengambilan keputusan dalam operasi logika. Terdiri dari true disimbolkan ‘T’ dan False yang disimbolkan ‘F’. dengan menggunakan operator and, or, atau not. Ketika kita ingin mendapatklan hasil yang valid/pasti, kita menggunakan tipe data boolean untuk memperoleh keputusan dalam suatu penyelesaian yang pasti

iii. Tipe char digunakan untuk mendifinisikan tipe data yang nilai nya merupakan himpunan karakter yang dikenal computer, dalam program konstanta tipe char ditulis diantara tanda petik (‘…’)

iv. Tipe Terbilang, Merupakan tipe data yang memiliki elemen-elemen tertentu yang disebut satu/satu dari bernilai konstanta integer sesuai dengan urutannya. disebut tipe terbilang karena semua nilai disebut satu persatu. Dan dalam tipe terbilang semua data harus diletakkan diantara tanda kurung, urutan dalam data terbilang harus benar-benar diperhatikan karena akan mempengaruhi nilai fungsi pred dan succ. Pada tipe data ini elemen masukan diwakili oleh suatu nama variable yang ditlis di dalam kurung.

Example:
Indeks_Hari = (Nol, Minggu, Senin, Selasa, Rabu, Kamis, Jumat, Sabtu)

v. Tipe subjangkauan, Merupakan tipe data bilangan yang punya jangkauan nilai tertentu sesuai dengan definisi pada pemrogram.
Example:
Type Variabel=Nilai_awal…Nilai_akhir

b. Tipe real
Merupakan tipe data bilangan pecahan seperti real, yang berisi titik decimal. Dalam pascal paling sedikit harus ada satu digit sebelum dan sesudah titik decimal. Tidak boleh ada koma dan nilainya bias positif dan negative. Ada 5 macam tipe real, yaitu real, single, double, extended dan comp

2. Tipe string
Tipe string adalah data yang berisi sederetan karakter yang banyaknya karakter itu bias berubah-ubah sesuai kebutuhan yaitu dari 1 sampai 255 karakter
Example :
Var Nama : String
Nama merupakan sebuah variabel didefinisikan sebagai variabel bertipe string, maksudnya pada variabel tersebut digunakan untuk menerima masukan sebuah nama yang terdiri dari sekumpulan huruf, dapat berupa huruf besar, kecil, atau campuran kedua-duanya.
3. Tipe terstruktur
Dalam tipe terstruktur setiap perubahan bias menyimpan lebih dari sebuah nilai data. Masing-masing nilai data disebut dengan komponen. Karakteristik data bertipe terstruktur diteentukan berdasrakan cara penstrukturan dan tipe masing-masing komponen.
Ada empat buah tipe data terstruktur, yaitu larik, rekaman, himpunan dan berkas

a. Larik atau array adalah tipe terstruktur yang mempunyai komponen dalam jumlah yang tetap dan setiap komponen mempunyai tipe data yang sama. Posisi masing-masing komponen dalam lirik dinyatakan sebagai nomer index
• Cara mendefinisikan tipe data array
Berdimensi satu
Var
Nama_Variabel_Array[1...N]of tipe_data
1 Nomor Indeks
• Berdimensi dua
Var
Nama_Variabel_Array=Array[1...N,1...M]of tipe_data
2 buah Nomor Indeks
b. Tipe Data Record, Tipe data komposit yang sudah terstruktur denagn baik. Tipe data ini digunakan untuk menampung data suatu obyek. Datanya berupa campuran dari tipe data seperti string, numerik, char, boolean, atau tipe data lainnya. Tipe data ini merupakan struktur dasar dari suatu sistem database.

c. Tipe Himpunan, Himpunan (set) adalah kumpulan objek yang mempunyai tipe data yang sama dan urutan penulisannya tidak diperhatikan. Setiap objek di dalam setiap himpunan disebut dengan anggota atau elemen himpunan. Huruf-huruf dalam alphabet merupakan sebuah himpunan.

d. Tipe Berkas, Berkas (file) adalah kumpulan sejumlah komponen yang bertipe data yang sama, yang jumlahnya tidak tertentu, dan biasanya tersimpan dalam suatu media penyimpanan luar

4. Tipe pointer
Semua tipe yang telah digunakan diatas, apabial digunakan untuk mendeklarasikan suatu perubah, maka sifat perubah tersebut adalah perubah yang statis.


Kamis, 07 Oktober 2010

SYARAT SEORANG PEMILIH DALAM PEMILU

1. masukkan calon pemilih
2. Warga Negara Indonesia
3. yang telah genap berusia 17 (tujuh belas) tahun atau lebih atau sudah/pernah kawin
4.  terdaftar sebagai pemilih di daerahnya
5. tidak sedang terganggu jiwa/ingatannya
6. Tidak sedang dicabut hak pilihnya berdasarkan keputusan pengadilan yang telah mempunyai hukum tetap
7. hasil pemilih yang telah memenuhi syarat

FLOWCHAT NYA :





Sabtu, 25 September 2010

MEMBUAT SUDUT 45 DERAJAT DARI GARIS 180 DERAJAT DENGAN JANGKA

  1. Buatlah garis lurus 180 derajat
  2. membuat sudut 90 derajat Ambil sembarang titik A sebagai pusat pada garis lurus
  • Buatlah busur lingkaran melalui titik pusat sehingga mendapatkan titik B dan C
  • Dari dua buah titik B dan C sebagai pusat dan jari-jarinya tetap sama, buatlah busur lingkaran yang saling berpotongan di suatu titik D
  • Kemudian hubungkan titik A dengan busur lingkarang yg saling berpotongan D, maka besar sudut adalah 90 derajat
 3. Membagi sudut dari sudut 90 derajat
  • Dan lukislah garis bagi dari sudut 90derajat, dengan cara membuat busur lingkaran dari titik A sehingga memotong garis AB di E dan AC di F
  • Dari dua buah titik E dan F sebagai pusat dan jari-jarinya tetap sama, buatlah busur lingkaran yang saling berpotongan di suatu titik G
  • Kemudian hubungkan titik A dan G, yang akan membagi dua sudut yang sama, sehingga membentuk sudut 45 derajat, 1/2×90=45
FLOWCHAT NYA :


Jumat, 24 September 2010

ARTICLE PASCAL

A. WHAT IS PASCAL ?
high level programming language developed by Niklaus Wirth in Zurich in the late 1960s until the early 1970s. Pascal is a structured programming language, so often used as a means of beginning to learn computer programming techniques. Pascal language versions that are widely used artificial Turbo Pascal Borland International, which works in DOS environment. Later, Pascal also developed as a visual programming language in Windows operating system environment with the name of Delphi.

B. HISTORY of PASCAL
Pascal is based on the ALGOL programming language and named in honor of mathematician and philosopher Blaise Pascal. Wirth subsequently developed the Modula-2 and Oberon, languages similar to Pascal, and earlier, also the language Euler.
Initially, Pascal was a language intended to teach students structured programming, and generations of students have "cut their teeth" on Pascal as an introductory language in undergraduate courses. Variants of Pascal are still widely used today, for example Free Pascal can be used in both 32 and 64 bit formats, and all types of Pascal programs can be used for both education and software development
Examples of usage
Pascal was the primary high-level language used for development in the Apple Lisa, and in the early years of the Mac; parts of the original Macintosh operating system were hand-translated into Motorola 68000 assembly language from the Pascal sources. The popular typesetting system TeX by Donald E. Knuth was written in WEB, the original literate programming system, based on traditional Pascal, while an application like Total Commander was written in Delphi (i.e. Object Pascal).

C. ABOUT BLAISE PASCAL (1623 – 1662)


Blaise Pascal was born June 19, 1623 in Clermont, Auvergne, France. Blaise's mother died when he was three years old. Blaise's father, Etienne, oversaw Blaise's education at home. Etienne decided that Blaise was not to study mathematics until age 15. At age 12, Blaise's curiosity in geometry grew as he rediscovered many of Euclid's elements on his own. When his father realized this he relented and gave Blaise a copy of Euclid's book.
In 1639 the family moved to Rouen where Etienne had been appointed as a tax collector. Blaise had his first paper, Essay on Conic Sections published in February 1640. In an effort to make his father's work easier, Pascal invented a calculator, which used the movement of gears to add or subtract. The device was called the Pascaline and it resembled the mechanic calculator of the 1940's. Only about 50 calculators were manufactured, because not many could afford the price.
In 1647 Pascal wrote New Experiments Concerning Vacuums, however many scientists disagreed on whether a vacuum exists. Descartes visited Pascal for two days and they argued about the vacuum. In a letter that Descartes wrote to Huygens he stated, "Pascal has too much vacuum in his head." Pascal continued to work on mathematics and physics writing Treatise on the Equilibrium of Liquids (1653) and The generation of Conic Sections (1654).
Pascal wrote Treatise on the Arithmetical Triangle, which is a triangular array of numbers that had been handed down by Chinese mathematicians several centuries earlier. Pascal discovered new properties of the triangle and solved problems using it, therefore the triangle became known as "Pascal's Triangle."
Pascal became interested in probability when given a gambling question. The dice problem asks how many times one must throw a pair of dice before one expects a double six while the problem of points asks how to divide the stakes if a game of dice is incomplete. In correspondence with Fermat, they solved the problem of points for a two-player game. Pascal with Fermat laid the foundation for the theory of probability.
Pascal nearly lost his life in an accident in 1654. The horses pulling his carriage bolted and the carriage was left hanging over a bridge above the Seine River. Although he was not physically hurt, this accident affected him psychologically. He soon pledged his life to Christianity. Much of his work was then centered on theology. In his work Pensees, Pascal claims to prove that belief in God is rational with the following argument. "If God does not exist, one will lose nothing by believing in him, while if he does exist, one will lose everything by not believing. We are compelled to gamble."
Pascal suffered a toothache, which kept him awake at night. In an effort to take his mind off the pain he focused on the cycloid, the curve traced by a point on the circumference of a rolling circle. Pascal solved the problem of the area of any segment of the cycloid and the center of gravity of any segment. He also solved the problems of the volume and surface area of the solid of revolution formed by rotating the cycloid about the x-axis.
Pascal died at the age of 39 from a malignant stomach ulcer. Pascal never married and he will be remembered by his work in mathematics, physics, philosophy, and religion.

D. PASCAL PROGRAMMING LANGUAGE
The computer programming language Pascal is one of the landmark programming languages on which generations of students cut their teeth and variants of which are still widely used today. TeX and much of the original Macintosh operating system were written in Pascal.
1. Pascal and C
Pascal was developed about the same time as C, and there are important similarities between the two. Both were strongly influenced by Algol 60 and incorporate many of its essential features, including its block structure and type system, although the approach to type safety is quite different.
The original Pascal and straight C are both small procedural languages implementing structured programming concepts. Both have functionality for dynamic allocation of memory and some form of pointer manipulation. However, Pascal was designed, mainly, as a teaching language. Error-prone constructs were carefully avoided, and an effort was made to make the syntax easy to understand. The authors of C placed more emphasis on brevity, because C was designed for professional programmers.
The main differences between the original Pascal and C are the following:
• C has lots of operations which change their first operand (++ -- += etc.) There is no consensus on the use of these operators.
• C has bitwise operations (| & ^ ~ << >>), while Pascal has sets.
• C allows much greater freedom with pointers. In C, you can access any address in memory directly: given a variable a, an operation &a returns its address. There are functions malloc() and calloc() which allocate any number of bytes. Pointers and arrays are often interchangeable. This makes C more concise than Pascal for low-level programming, but can lead to difficult to trace bugs.
• Pascal allows passing parameters either by value or by reference. In C, parameters can be passed only by value, and call by reference requires explicitly passing a pointer value.
• Pascal provides subrange types, which are very useful for early detection of bugs.
• Pascal lacks separate compilation.
• Pascal lacks preprocessing. There is nothing in original Pascal which resembles #include, #define, #ifdef etc.
• C supports different lengths of numbers (short int, int and long int; float and double) and unsigned integer numbers and characters. In Pascal, all numbers are of fixed length, and there are no unsigned numbers.
• In C, there is no boolean type.
• C lacks typesafe enumerated types which are present in Pascal.
• Pascal lacks continue and break operators.
• Pascal permits nested function definitions.
• Pascal doesn't guarantee anything about certain border cases like if x is passed twice to the same procedure (once by reference, once by value). This is the classic, but true "why Pascal is faster than C" joke in NGs.
• the original Pascal disallowes pointers inside of symbols. (e.g. @/& of a record field is disallowed), this has great consequences for implementation on top of a Virtual Machine
Together, these differences made the original Pascal significantly simpler and safer than C, but less useful (in fact, almost useless) for professional programming. Therefore already as early as 1980, dialects with extensions started to emerge, with Turbo Pascal as dominant version.
Modern implementations of Pascal eliminate nearly all major flaws (and add means for object-oriented programming), making Pascal as useful as C or C++, whilst retaining the characteristic simplicity and safety of the language. However most modern Pascal compilers focus on application development rather than system development, which has different requirements from a programming language.
2. Implemantations
Early approaches (most notably the UCSD p-System compiler, based on the Zürich P4 compiler, both of which were written in Pascal itself) translated Pascal code into a machine-independent p-Code representation. This intermediate code was then interpreted by a program specific to each architecture. As a consequence, only the small interpreter part had to be ported to many architectures.
In the 1980s Anders Hejlsberg wrote the Blue Label Pascal compiler for the Nascom-2. Later he went to work for Borland and rewrote his compiler to become Turbo Pascal for the IBM PC. This new compiler sold for $49.95, which was much less than the price Hejlsberg originally asked for the Blue Label Pascal compiler.
The inexpensive Borland compiler had a large influence on the Pascal community that began concentrating mainly on the IBM PC in the late 1980s. Many PC hobbyists in search of a structured replacement for BASIC used this product. Turbo Pascal, being available only on one architecture, translated directly to Intel 8088 machine code, making it much faster than interpreted schemes.
Super Pascal was a variant which added non-numeric labels, a return statement and expressions as names of types.
During the 1990s compilers that could be re-targeted to different hardware architectures became more prevalent. This allowed for Pascal translation to native machine code that was at the same time easily ported to new hardware.
With Turbo Pascal version 5.5 Borland added object orientation to Pascal.
However, Borland later decided it wanted more elaborate object-oriented features, and started over in Delphi using the Object Pascal draft standard proposed by Apple as a basis. (This Apple draft isn't a formal standard yet.) Borland also called this Object Pascal in the first Delphi versions, but changed the name to Delphi programming language in later versions. The main additions compared to the older OOP extensions were a reference-based object model, virtual constructors and destructors, and properties. There are several other compilers implementing this dialect: see Delphi programming language.