Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

PENGENALAN BAHASA C / C++

Presentasi serupa


Presentasi berjudul: "PENGENALAN BAHASA C / C++"— Transcript presentasi:

1 PENGENALAN BAHASA C / C++
Erizal, S.Si, M.Kom Sistem Informasi STTI Respati

2 Program dan Bahasa Pemrograman C
Contoh program dalam Bahasa C untuk meng-input dua buah bilangan, menghitung dan mencetak totalnya Turbo C C++ #include <stdio.h> void main() { int A, B, T; scanf(“ %i ”, &A); scanf(“ %i ”, &B); T = A + B; printf(“ %i ”, T); } #include <iostream.h> void main() { int A, B, T; cin >> A; cin >> B; T = A + B; cout << T; }

3 Struktur Bahasa C - void main() {
statement } Beberapa contoh penempatan tanda kurung { dan } sebagai batas sebuah main program. void main() { statement } 1. statement } 2. { statement 3. 4. void main() { 5. 6.

4 Keywords dan Library Functions
Turbo C C++ #include <stdio.h> void main() { int A, B, T; scanf(“ %i ”, &A); scanf(“ %i ”, &B); T = A + B; printf(“ %i ”, T); } #include <iostream.h> void main() { int A, B, T; cin >> A; cin >> B; T = A + B; cou << T; } Perhatikan kata-kata (words) yang ada dalam kedua program tersebut, yaitu : include stdio.h stream.h void int main() scanf() printf() cin cout

5 Keyword dalam Bahasa C Keywords dalam ANSI C
(ANSI = American National Standards Institute) auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while Keywords tambahan dalam TURBO C Selain keywords yang ada pada ANSI C, Turbo C menambah beberapa keywords yaitu : asm cdecl far huge interupt near pascal

6 Keyword pada C++ Selain keywords yang ada pada ANSI C, C++ menambah beberapa keywords yaitu : asm class delete friend inline new operator private protected public template this virtual

7 Library Functions dan Library Macroes dalam Turbo C
1) Dalam stdio.h Library Functions Library Macroes clearr() fclose() fccloseall() fdopen() fflush() fgetc() fgetchar() fgetpos() fgets() flushall() fopen() fprint() fputc() fputchar() fputs() fread() free() freopen() fscan() fseek() fsetpos() ftell() fwrite() gets() getw() perror() printf() puts() putw() rename() rewind() scanf() unlink() feof(f) ferror(f) fileno(f) getch(f) getchar(f) putchar( f) remove(path)

8 2) Dalam math.h Library Functions abs() acosh() asin() atan() atan2() atof() ceil() cos() cosh() exp() fabs() floor() fmod() labs() ldexp() log() log10() pow() sin() sinh() sqrt() tan() tanh() 3) Dalam stdlib.h Library Functions Library Macroes abs() atof() atoi() atol() div() exit() Free() ldiv() malloc() rand() srand() system() abs(x) atoi(s) random(num) randomize()

9 4) Dalam string.h 5) Dalam conio.h 6) Dalam io.h Library Functions Library Functions Library Functions strcpy() strcat() strchr() strcmp() strlen() clrscr() getch() getche() gotoxy() khbit() putch() access() _close() close() _creat() eof() filelength() _ope() open() _read() read() _write() write() 7) Dalam ctype.h Library Functions Library Macroes isalnum( c) isalpha( c) isascii( c) iscntrl( c) isdigit( c) isgraph( c) islower ( c) isprint( c) ispunct( c) isspace( c) isupper( c) isxdigit( c) toascii( c) _tolower( c) _toupper( c) stlower() toupper()

10 Latihan

11 Tugas Jelaskan fungsi masing-masing libary berikut ini : stdio.h
math.h stdlib.h string.h conio.h ctype.h fclose() fopen() fprint() fwrite() gets() printf() scanf() log() log10() pow() sqrt() abs() atof() atoi() div() exit() malloc() rand() strcpy() strcat() strcmp() strlen() clrscr() getch() gotoxy() stlower() toupper()

12 END OF MODUL


Download ppt "PENGENALAN BAHASA C / C++"

Presentasi serupa


Iklan oleh Google