pengenalan bahasa c / c++
DESCRIPTION
PENGENALAN BAHASA C / C++. Erizal , S.Si , M.Kom Sistem Informasi STTI Respati [email protected] http://erizal.wordpress.com. Program dan Bahasa Pemrograman C. Contoh program dalam Bahasa C untuk meng-input dua buah bilangan, menghitung dan mencetak totalnya. Turbo C. C++. - PowerPoint PPT PresentationTRANSCRIPT
PENGENALAN BAHASA C / C++
Erizal, S.Si, M.KomSistem Informasi
STTI [email protected]
http://erizal.wordpress.com
#include <stdio.h>void main(){ int A, B, T; scanf(“ %i ”, &A); scanf(“ %i ”, &B); T = A + B; printf(“ %i ”, T);}
Contoh program dalam Bahasa Cuntuk meng-input dua buah bilangan,menghitung dan mencetak totalnya
#include <iostream.h>void main(){ int A, B, T; cin >> A; cin >> B; T = A + B; cout << T;}
Turbo C C++
Program dan Bahasa Pemrograman C
----
void main() { statement statement statement statement }----
Beberapa contoh penempatan tanda kurung { dan }sebagai batas sebuah main program.
void main(){ statement statement statement statement
}
1.void main(){ statement statement statement
statement }
2.void main(){ statement statement statement statement
}
3.void main(){ statement statement statement
statement }
4.void main() { statement statement statement statement
}
5.void main() { statement statement statement
statement }
6.
Struktur Bahasa 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;}
Turbo C C++
Perhatikan kata-kata (words) yang ada dalam kedua program tersebut, yaitu :
include stdio.hstream.h
main()scanf()printf()cincout
voidint
Keywords dan Library Functions
Keywords dalam ANSI C(ANSI = American National Standards Institute)
autobreakcasecharconstcontinuedefault
dodoubleelseenumexternfloatfor
gotoifintlongregisterreturn
shortsignedsizeofstaticstructswitch
typedefunionunsignedvoidvolatilewhile
Keywords tambahan dalam TURBO C
Selain keywords yang ada pada ANSI C, Turbo C menambah beberapa keywords yaitu :
asmcdeclfarhuge
interuptnearpascal
Keyword dalam Bahasa C
Selain keywords yang ada pada ANSI C, C++ menambah beberapa keywords yaitu :
asmclassdeletefriendinline
newoperatorprivateprotectedpublic
templatethisvirtual
Keyword pada C++
1) Dalam stdio.hLibrary Functions
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()
Library Macroes
feof(f)ferror(f)fileno(f)getch(f)getchar(f)putchar( f)remove(path)
Library Functions dan Library Macroes dalam
Turbo C
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
abs()atof()atoi()atol()div()exit()
Free()ldiv()malloc()rand()srand()system()
abs(x)atoi(s)random(num)randomize()
Library Macroes
4) Dalam string.h
Library Functionsstrcpy()strcat()strchr()strcmp()strlen()
5) Dalam conio.h
Library Functionsclrscr()getch()getche()gotoxy()khbit()putch()
6) Dalam io.h
Library Functions
access()_close()close()_creat()eof()
filelength()_ope()open()_read()read()_write()write()
7) Dalam ctype.h
Library Functions
stlower()toupper()
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)
LatihanLatihan
TugasTugasJelaskan 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()
END OF MODULEND OF MODUL