Library yang Sering Digunakan pada program C/C++

 1.    Library iostream.h (Standard Input / Output Streams Library). Objek iostream mewarisi semua anggota yaitu istream dan ostream, sehingga mampu melakukan kedua operasi input dan output.  
Elemen iostream library (char instantion) : 
  • ·         Classes : | ios_base Base | ios | istream | ostream | iostream | ifstream | ofstream | fstream | istringstream | ostringstream | stringtream | streambuf | filebuf | stringbuf |  
  • ·         Objects : | cin | cout | cerr | clog | 
  • ·         Types : | fpos : | streamoff | streampos | streamsize | 
  • ·         Manipulators : | boolalpha | dec | endl | ends | fixed | flush | hex | internal | left | noboolalpha | noshowbase | noshowpoint | noshowpos | noskipws | nounitbuf | nouppercase | oct | resetiosflags | right | scientific | setbase | setfill | setiosflags | setprecision | setw | showbase | showpoint | showpos | skipws | unitbuf | uppercase | ws | 


2.    Library stdio.h adalah library pada bahasa C yang digunakan untuk operasi input output (stdio = Standard Input and Output). Tanpa menggunakan library ini maka perintah - perintah input/output tidak dapat dieksekusi atau dijalankan.
  • ·         Library 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) | 
  • ·         Contoh penggunaan library stdio.h dengan library functions printf() dalam program :

#include
int main()
{
   printf("HelloWorld!\n");
   printf("Selamat Belajar C Program.");
   return 0;
  • ·         Contoh penggunaan library stdio.h dengan library functions puts() dalam program :

#include
#include
using namespace std;
int main()
{
   char x[20]="Ilmu Komputer";
   puts("Sekolah Siap Kerja Hanya di ");
   puts(x);
   return 0;

3.    Library math.h merupakan sebuah library yang disediakan untuk melakukan perhitungan secara matematika dan mendefinisikan fungsi matematika umum. 
  • ·         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() | 
  • ·         Contoh penggunaan library math.h dengan library functions cos() dan sin() dalam program : 

          //Penggunaan library math.h
         #include
         #include
         using namespace std;
         int main()
   {    
        double kecepatan, jarak, sudut;    
        kecepatan=20;    
        sudut=25;
        jarak = 2*kecepatan*kecepatan*sin(sudut*3.14/180)*cos(sudut*3.14/180)/9.8;
        cout<<"Jarak = "<
        cout<<"\n";    
        system("Pause");    
        return 0;
   } 

4.    Library stdlib.h mendefinisikan fungsi konversi numerik , pseudo-acak nomor fungsi generasi , alokasi memori , fungsi kontrol proses.  Library stdlib.h merupakan library yang hampir sama dengan library math.h, namun isi dari library stdlib.h berbeda dengan library math.h yaitu : 
  • ·         Library Functions : | abs() | atof() | atoi() | atol() | div() | exit() | free() | ldiv() | malloc() | rand() | srand() | system() | 
  • ·         Library Macroes : | abs(x) | atoi(s) | random(num) | randomize() | 
  • ·         Contoh penggunaan library stdlib.h dengan library functions atoi() dalam program : 

          //Penggunaan library stdlib.h
         #include
         #include
         using namespace std;
         int main()
   {    
         char karakter[8]="12.3AB";    
         int nilai;    
         nilai=atoi(karakter);    
         cout<
         system("Pause");    
         return 0;
   } 

5.    Library string.h merupakan suatu library pada bahasa C yang digunakan untuk memberikan nilai suatu karakter string. 
  • ·         Library Functions : | strcpy() | strcat() | strchr() | strcmp() | strlen() | 
  • ·         Contoh penggunaan library string.h dengan library functions strcpy() dalam program : 

          //Penggunaan library string.h
          #include
          #include
          using namespace std;
          int main()
    {
          char info[30];
          strcpy(info, "info: Ilmu Komputer");
          cout<
          system("Pause");
          return 0;
    } 

6.    Library conio.h
  • ·         Library Functions : | clrscr() | getch() | getche() | gotoxy() | khbit() | putch() | 
  • ·         Contoh penggunaan library conio.h dengan library funtions getche() atau getch() dalam program :

          //Penggunaan library conio.h
          #include
          #include
          using namespace std;
          int main()
    {
           cout<<"Selamat datang mahasiswa baru Ilmu Komputer \n";
           getche();
    } 


7.    Library io.h
  • ·         Library Functions : | access() | _close() | close() | _creat() | eof() | filelenght() | _open() | open() | _read() | read() | _write() | write() |  


8.    Library 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) |


Library lainnya pada program C antara lain:




Previous
Next Post »

1 komentar:

Click here for komentar
4 Maret 2022 pukul 17.21 ×

Mádney – CASINO ONLINE IN MY STATE - DRMCD
Online gambling 용인 출장마사지 is legal 통영 출장마사지 in the Philippines today, as the law only allows a 군산 출장안마 포항 출장안마 Mádney is located in Mádney, Philippines and operates as a mobile casino 김해 출장마사지

Congrats bro egidiusgaffaney you got PERTAMAX...! hehehehe...
Reply
avatar
Thanks for your comment