{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Diktat_ProgKecilBhsC - Contoh Program Kecil Dalam Bahasa C...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Contoh Program Kecil Dalam Bahasa C Oleh : Inggriani Liem Jurusan Teknik Informatika Institut Teknologi Bandung Versi Online, Agustus 2003
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DAFTAR ISI PROGRAM C ........................................................................................................................................................................ 4 /* File hello.c */ ................................................................................................................................................................. 4 /* File : hello1.c */ ............................................................................................................................................................. 4 ASSIGNMENT, INPUT & OUTPUT ................................................................................................................................... 4 /* File : ASIGN.C */ .......................................................................................................................................................... 4 /* File asgdll.c */ ................................................................................................................................................................ 4 /* File : ASIGNi.C */ ......................................................................................................................................................... 4 /* File : asign2.c */ ............................................................................................................................................................. 5 OPERATOR & EKSPRESI ................................................................................................................................................... 6 /* File : incr.c */ ................................................................................................................................................................. 6 /* File : oper1.c */ .............................................................................................................................................................. 6 /* File : oprator.c */ ............................................................................................................................................................ 7 /* File : oper2.c */ .............................................................................................................................................................. 7 /* File : exp.c */ ................................................................................................................................................................. 8 /* File : exp1.c */ ............................................................................................................................................................... 8 /* File : oper3.c */ .............................................................................................................................................................. 9 PEMBACAAN NILAI .......................................................................................................................................................... 9 /* File : BACA.C */ ........................................................................................................................................................... 9 /* file : bacakar.c */ ............................................................................................................................................................ 9 /* File : BACASTR.C */ .................................................................................................................................................... 9 /* File : asgSTR.C */ ....................................................................................................................................................... 10 KONSTANTA & KALKULASI SEDERHANA ............................................................................................................... 10 /* File : KONSTANT.C */ .............................................................................................................................................. 10 /* File : KONSTAN2.C */ ............................................................................................................................................... 10 INSTRUKSI KONDISIONAL ............................................................................................................................................ 12 /* File : IF1.C */ ............................................................................................................................................................... 12 /* File : IF2.C */ ............................................................................................................................................................... 12 /* File : IF3.C */ ............................................................................................................................................................... 13 /* File : tempair.c */ ......................................................................................................................................................... 13 /* File : KASUS.C */ ....................................................................................................................................................... 14 /* File dll.c */ ................................................................................................................................................................... 14 PENGULANGAN ............................................................................................................................................................... 15 /* File : PRIFOR.C */ ...................................................................................................................................................... 15 /* File : PRIREP.C */ ....................................................................................................................................................... 16 /* File : PRXREP.C */ ..................................................................................................................................................... 16 /* file : PRITER.C */ ....................................................................................................................................................... 17 /* File : PRXITER.C */ ................................................................................................................................................... 17 /* File : PRIW.C */ .......................................................................................................................................................... 17 /* File : PRIWHILE1.C */ ............................................................................................................................................... 18 /* File : PRXWHILE.C */ ............................................................................................................................................... 18 /* File : FOREVER.C */ .................................................................................................................................................. 18 PROSEDUR & FUNGSI ..................................................................................................................................................... 19 /* File : subprg.C */ ......................................................................................................................................................... 19 /* File : calljam.c */ ......................................................................................................................................................... 19 TYPE ENUMERASI ........................................................................................................................................................... 21 TYPE KOMPOSISI ............................................................................................................................................................. 22 /* File : STRUK.C */ ....................................................................................................................................................... 22 /* File struk2.c */ ............................................................................................................................................................. 22 /* File : struk3.c */ ........................................................................................................................................................... 23 UNION ................................................................................................................................................................................. 24 /* File union.c */ .............................................................................................................................................................. 24 /* File : RecVar.c */ ......................................................................................................................................................... 24 /* File : RecVarx.c */ ....................................................................................................................................................... 25 BITFIELD ............................................................................................................................................................................ 26 /* File : bitf.c */ ................................................................................................................................................................ 26 POINTER ............................................................................................................................................................................. 27 /* File : pointa1.c */ ......................................................................................................................................................... 27
Background image of page 2
/* File : STRUKptr.C */ .................................................................................................................................................. 28 ARRAY ................................................................................................................................................................................ 30 /* File : tabel.c */ ............................................................................................................................................................. 30 /* File : tabel1.c */ ........................................................................................................................................................... 31 /* File : tabel2.c */ ........................................................................................................................................................... 31 /* File : tabel3.c */ ........................................................................................................................................................... 32 /* File : arrstru.c */ ........................................................................................................................................................... 33 /* File : tarrstr.c */ ............................................................................................................................................................ 33 /* File : arrstr.c */ ............................................................................................................................................................. 34 /* File : tabparam.c */ ...................................................................................................................................................... 35 /* File : tabstr.c */ ............................................................................................................................................................ 36 /* File : tabstrin.c */ ......................................................................................................................................................... 36 /* File : tabstru.c */ .......................................................................................................................................................... 36 /* File : bacatab1.c */ ....................................................................................................................................................... 38 /* File : bacatab2.c */ ....................................................................................................................................................... 39 /* File : bacatab2.c */ ....................................................................................................................................................... 39 EXTERNAL FILE ............................................................................................................................................................... 40 /* File : filetxt2.c */ .......................................................................................................................................................... 40 /* File : filetxt.c */ ............................................................................................................................................................ 41 /* File : filetxt1.c */ .......................................................................................................................................................... 42 /* fileint.c */ ..................................................................................................................................................................... 42 /* filerek.c */ .................................................................................................................................................................... 43 /* filekoma.c */ ................................................................................................................................................................ 44 PROGRAM DALAM BEBERAPA MODUL .................................................................................................................... 45 /* File : jam.h */ ............................................................................................................................................................... 45 /* File : jam.c */ ............................................................................................................................................................... 45 /* File : mjam.c */ ............................................................................................................................................................ 46 /* File : jam1.c */ ............................................................................................................................................................. 47 MACRO KONDISIONAL .................................................................................................................................................. 48 /* File : jamm.c */ ............................................................................................................................................................ 48 PROGRAM DENGAN PARAMETER .............................................................................................................................. 48 /* File : prgparam.c */ ...................................................................................................................................................... 48 POINTER TO FUNCTION ................................................................................................................................................. 50 /* File : pointf.c */ ............................................................................................................................................................ 50 /* File : pointf1.c */ .......................................................................................................................................................... 52 /* File : pointf2.c */ .......................................................................................................................................................... 53 /* File : pointf3.c */ .......................................................................................................................................................... 54 /* File : pointf4.c */ .......................................................................................................................................................... 56 /* File : pointf5.c */ .......................................................................................................................................................... 57 SCOPE & LIFETIME .......................................................................................................................................................... 59 /* File : scope.c */ ............................................................................................................................................................ 59 /* File : blok.h */ .............................................................................................................................................................. 60 /* File : blok.c */ .............................................................................................................................................................. 60 /* File : blokmain.c */ ...................................................................................................................................................... 61 boolean.h .............................................................................................................................................................................. 62 Mesin Karakter ..................................................................................................................................................................... 62 /* File : mesinkar1.h */ ................................................................................................................................................... 62 /* File : mesinkar1.c */ ................................................................................................................................................... 62 /* file : mainkar.c */ ......................................................................................................................................................... 63 /* File : mesinkar.h */ ..................................................................................................................................................... 64 /* File : mesinkar.c */ ..................................................................................................................................................... 64
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
PROGRAM C /* File hello.c */ void main() { printf("hello\n "); } /* File : hello1.c */ /* menuliskan hello ke layar */ /* pola ini merupakan standard yang dipakai di kelas */ int main () { /* KAMUS */ /* ALGORITMA */ printf ("hello\n"); return 0; } ASSIGNMENT, INPUT & OUTPUT /* File : ASIGN.C */ /* Assignment nilai integer dan print */ int main () {/* Kamus */ int i; /* Program */ printf ("hello\n"); i = 5; printf ("Ini nilai i : %d \n", i); return 0; } /* File asgdll.c */ int main() { /* Kamus */ float f; long double fll; /* Algoritma */ f= 20.0f; fll=10.0L; return 0; } /* File : ASIGNi.C */ /* Assignement dan print */
Background image of page 4
#include <limits.h> int main () { /* Kamus */ int i; long int ii; /* Program */ printf ("hello\n"); i = 1234; ii = 123456; printf ("Ini nilai i=1234 = : %d \n", i); printf ("Ini nilai ii=123456 : : %10d \n", ii); /* print nilai batas integer */ printf (“Min dan Max integer : %d, %d \n”, INT_MIN, INT_MAX); printf (“Max long integer : %ld, %ld \n”, LONG_MAX); return 0; } /* File : asign2.c */ /* Deskripsi : */ /* Program ini berisi contoh sederhana untuk mendefinisikan */ /* variabel-variabel bilangan bulat (short int, int, long int), */ /* karakter, bilangan riil, */ /*------------------------------------------------------------------- */ int main () { /* KAMUS */ short ks = 1; int ki = 1; long kl = 10000; char c = 65; /* inisialisasi karakter dengan integer */ char c1 = 'Z'; /* inisialisasi karakter dengan karakter */ float x = 1.55; /* Algoritma */
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}