PROGRAM PASCAL INDEKS NILAI
Pengikut
Senin, 08 November 2010
Program Pascal dan Algoritma dari Menentukan Faktorial
ALGORITMA DARI MENENTUKAN FAKTORIAL
1. Masukan (n)
2. Hasil <-1
3. Hasil bilangan < - nsampai dengan 1, langkah -1
sehingga hasil < hasil di kali suatu bilangan akhir untuk
4. Tampilkan asil
Sebagai contohnya : 3! = 3 x 2 x 1 = 6
5! = 5 x 4 x 3 x 2 x 1 = 120
Sabtu, 30 Oktober 2010
ALGORITMA MENENTUKAN HARI
ALGORITMA MENENTUKAN HARI
- Tentukan nama hari Senin sampai Minggu
- Berikan kode pada masing - masing hari
contohnya :
kode 1 = Senin dan seterusnya secara berurutan hingga
kode ke 7 = minggu
- Jika kode 1 maka Senin
Jika kode 2 maka Selasa
Jika kode 3 maka Rabu
Jika kode 4 maka Kamis
Jika kode 5 maka Jum’at
Jika kode 6 maka Sabtu
Jika kode 7 maka Minggu
- Hasil.
Sabtu, 16 Oktober 2010
TIPE-TIPE VARIABEL
TIPE DATA
Bentuk umum dari deklarasi tipe data adalah :
Type pengenal = tipe;
Dengan pengenal : nama pengenal yang menyatakan tipe data.
Tipe : Tipe data yang berlaku dalam Turbo pascal.
Tipe data bagi menjadi 4 (empat) :
1. Tipe sederhana.
2. tipe string
3. tipe terstruktur, dan
4. tipe pointer.
1. TIPE SEDERHANA
Tipe sederhana di bagi menjadi 2 (dua) : tipe ordinal dan tipe Real.
A. TIPE ORDINAL
Tipe Ordinal adalah subset dari tipe sederhana. Semua tipe di sebut tipe ordinal kecuali real.
Karakteristik tipe data ordinal :
Semua kemungkinan nilai dari suatu tipe ordinal merupakan himpunan berurutan (ordered set), dan setiap nilai berkaitan dengan ordinalitasnya, yaitu Integral.
Fungsi standard ord dapat di terapkan pada sembarang tipe ordinal untuk mengetahui ordinalitasnya.
Fungsi standard pred dapat di terapkan untuk mengetahui predesesornya.
Fungsi standard succ dapat di terapkan untuk mengetahui suksesornya.
Turbo pascal mempunyai 7(tujuh) tipe ordinal standard yaitu Integer, shortint, Longint, byte, word, Boolean, dan char. Di samping itu ada dua tipe ordinal yang bisa di definisikan sendiri oleh pemakai (user-defined data types) yaitu tipe subjangkauan (subrange) dan terbilang (enumerated).
TIPE INTIGER
Dalam pascal hanya Digit yang bisa muncul sebagai integer dengan demikian tidak ada karekter lain, misalnya koma, yang di perbolehkan . Tanda plus atau minus dapat mendahului bilangan tersebut.
Ada 5 (lima) tipe data yang termasuk dalam kelompok ini yaitu shortint, integer, longint, byte dan word.
TIPE BOOLEAN
TIPE CHAR
‘A’ ‘B’ ‘ , ’ ‘4’
TIPE TERBILANG
Urutan dalam data terbilang perlu di perhatikan karena akan mempengaruhi nilai fungsi pred dan succ.
TIPE SUBJANGKAUAN
B. TIPE REAL
Dalam turbo pascal terdapat lima macam tipe riil yaitu real single, double,extendd dan comp. Tipe single, double,extend dan comp hanya bisa di gunakan jika computer anda di lengkapi dengan koprosesor numeris 80*87.
2. TIPE STRING
3. TIPE TERSTRUKTUR
Tipe terstruktur di bagi menjadi 4 (empat) yaitu : Larik (array), rekaman (record), himpunan (set), dan berkas (file).
TIPE LARIK
TIPE REKAMAN
TIPE HIMPUNAN
TIPE BERKAS
4. TIPE POINTER
Minggu, 10 Oktober 2010
algoritma syarat WNI memiliki hak pilih
Algoritma dari Syarat syarat warga Negara yang yang memiliki hak pilih aktif
1. Warga Negara Indonesia
2. Telah berusia 17 tahun keatas atau sudah menikah
3. Terdaftar sebagai calon pemilih
4. Tidak sedang terganggu ingatannya atau sakit jiwa
5. Tidak sedang menjalani hukuman pidana penjara atau pidana kurungan
6. Tidak sedang di cabut hak pilih berdasarkan keputusan pengadilan yang telah memperoleh huakum tetap.
1. Warga Negara Indonesia
2. Telah berusia 17 tahun keatas atau sudah menikah
3. Terdaftar sebagai calon pemilih
4. Tidak sedang terganggu ingatannya atau sakit jiwa
5. Tidak sedang menjalani hukuman pidana penjara atau pidana kurungan
6. Tidak sedang di cabut hak pilih berdasarkan keputusan pengadilan yang telah memperoleh huakum tetap.
Minggu, 26 September 2010
Programming languages
Programming languages
Top The different notations used to communicate algorithms to a computer. A computer executes a sequence of instructions (a program) in order to perform some task. In spite of much written about computers being electronic brains or having artificial intelligence, it is still necessary for humans to convey this sequence of instructions to the computer before the computer can perform the task. The set of instructions and the order in which they have to be performed is known as an algorithm. The result of expressing the algorithm in a programming language is called a program. The process of writing the algorithm using a programming language is called programming, and the person doing this is the programmer. See also Algorithm.In order for a computer to execute the instructions indicated by a program, the program needs to be stored in the primary memory of the computer. Each instruction of the program may occupy one or more memory locations. Instructions are stored as a sequence of binary numbers (sequences of zeros and ones), where each number may indicate the instruction to be executed (the operator) or the pieces of data (operands) on which the instruction is carried out. Instructions that the computer can understand directly are said to be written in machine language. Programmers who design computer algorithms have difficulty in expressing the individual instructions of the algorithm as a sequence of binary numbers. To alleviate this problem, people who develop algorithms may choose a programming language. Since the language used by the programmer and the language understood by the computer are different, another computer program called a compiler translates the program written in a programming language into an equivalent sequence of instructions that the computer is able to understand and carry out. See also Computer storage technology.
Machine language
For the first machines in the 1940s, programmers had no choice but to write in the sequences of digits that the computer executed. For example, assume we want to compute the absolute value of A + B − C, where A is the value at machine address 3012, B is the value at address 3013, and C is the value at address 3014, and then store this value at address 3015.It should be clear that programming in this manner is difficult and fraught with errors. Explicit memory locations must be written, and it is not always obvious if simple errors are present. For example, at location 02347, writing 101… instead of 111… would compute |A + B + C| rather than what was desired. This is not easy to detect.
Assembly language
Since each component of a program stands for an object that the programmer understands, using its name rather than numbers should make it easier to program. By naming all locations with easy-to-remember names, and by using symbolic names for machine instructions, some of the difficulties of machine programming can be eliminated. A relatively simple program called an assembler converts this symbolic notation into an equivalent machine language program.The symbolic nature of assembly language greatly eased the programmer's burden, but programs were still very hard to write. Mistakes were still common. Programmers were forced to think in terms of the computer's architecture rather than in the domain of the problem being solved.
High-level language
The first programming languages were developed in the late 1950s. The concept was that if we want to compute |A + B − C|, and store the result in a memory location called D, all we had to do was write D = |A + B − C| and let a computer program, the compiler, convert that into the sequences of numbers that the computer could execute. FORTRAN (an acronym for Formula Translation) was the first major language in this period.FORTRAN statements were patterned after mathematical notation. In mathematics the = symbol implies that both sides of the equation have the same value. However, in FORTRAN and some other languages, the equal sign is known as the assignment operator. The action carried out by the computer when it encounters this operator is, “Make the variable named on the left of the equal sign have the same value as the expression on the right.” Because of this, in some early languages the statement would have been written as −D → D to imply movement or change, but the use of → as an assignment operator has all but disappeared.
The compiler for FORTRAN converts that arithmetic statement into an equivalent machine language sequence. In this case, we did not care what addresses the compiler used for the instructions or data, as long as we could associate the names A, B, C, and D with the data values we were interested in.
Structure of programming languages
Programs written in a programming language contain three basic components: (1) a mechanism for declaring data objects to contain the information used by the program; (2) data operations that provide for transforming one data object into another; (3) an execution sequence that determines how execution proceeds from start to finish.
MEMBUAT RANCANGAN ALGORITMA DENGAN MENGGUNAKAN FLOWCHART
Cara menyelesaikan permasalahan pada Pertidaksamaan linear…
1.Bacalah isi soal yang diketahui dengan jelas
2.Pahami apa pertanyaan dari soal tersebut
3.Gambarlah garis ax + by = c
4.Ambil sembarang titik P (X1,Y1) yang terletak diluar garis ax + by =c
5.subtitusikan titik tersebut ke dalam pertidaksamaan
6.apabila persamaan benar, maka daerah yang memuat titik p (X1,Y1) adalah himpunan penyelesaiannya,. Namun jika pertidaksamaan salah maka daerah lain yang tidak memuat titik p(X1,Y1) adalah himpunan penyelesaiannya.
jika kita menggunakan FLOWCHART maka akan tergambar seperti di bawah ini :
1.Bacalah isi soal yang diketahui dengan jelas
2.Pahami apa pertanyaan dari soal tersebut
3.Gambarlah garis ax + by = c
4.Ambil sembarang titik P (X1,Y1) yang terletak diluar garis ax + by =c
5.subtitusikan titik tersebut ke dalam pertidaksamaan
6.apabila persamaan benar, maka daerah yang memuat titik p (X1,Y1) adalah himpunan penyelesaiannya,. Namun jika pertidaksamaan salah maka daerah lain yang tidak memuat titik p(X1,Y1) adalah himpunan penyelesaiannya.
jika kita menggunakan FLOWCHART maka akan tergambar seperti di bawah ini :
Langganan:
Komentar (Atom)