C++
adalah bahasa pemrograman komputer C++ dikembangkan di Bell Labs (Bjarne
Stroustrup) pada awal tahun 1970-an, Bahasa itu diturunkan dari bahasa
sebelumnya, yaitu BCL, Pada awalnya, bahasa tersebut dirancang sebagai bahasa
pemrograman yang dijalankan pada sistem Unix, Pada perkembangannya, versi ANSI
(American National Standart Institute) Bahasa pemrograman C menjadi versi
dominan, Meskipun versi tersebut sekarang jarang dipakai dalam pengembangan
sistem dan jaringan maupun untuk sistem embedded, Bjarne Stroustrup pada Bell
labs pertama kali mengembangkan C++ pada awal 1980-an, Untuk mendukung
fitur-fitur pada C++, dibangun efisiensi dan sistem support untuk pemrograman
tingkat rendah (low level coding). Pada C++ ditambahkan konsep-konsep baru
seperti class dengan sifat-sifatnya seperti inheritance dan overloading. Salah
satu perbedaan yang paling mendasar dengan bahasa C adalah dukungan terhadap
konsep pemrograman berorientasi objek (Object Oriented Programming).
Perbedaan
Antara Bahasa pemrograman C dan C++ meskipun bahasa-bahasa tersebut menggunakan
sintaks yang sama tetapi mereka memiliki perbedaan, C merupakan bahasa
pemrograman prosedural, dimana penyelesaian suatu masalah dilakukan dengan
membagi-bagi masalah tersebut kedalam su-submasalah yang lebih kecil, Selain
itu, C++ merupakan bahasa pemrograman yang memiliki sifat Pemrograman
berorientasi objek, Untuk menyelesaikan masalah, C++ melakukan langkah pertama
dengan menjelaskan class-class yang merupakan anak class yang dibuat sebelumnya
sebagai abstraksi dari object-object fisik, Class tersebut berisi keadaan
object, anggota-anggotanya dan kemampuan dari objectnya, Setelah beberapa Class
dibuat kemudian masalah dipecahkan dengan Class.
Contoh Program C++
Contoh program sederhana C++ untuk hello
world dengan menggunakan Pustaka Dasar C++ dapat dilihat di bawah ini:
# include
void main()
{
Cout << “hello world\n”;
}
Keterangan
:
Baris
pertama :
#include
Sebagai
bagian dari proses kompilator, Kompilator dari c++ menjalankan program yang
dinamakan preprosesor. Preprosesor memiliki kemampuan menambahkan dan menghapus
kode dari sumber, Pada bagian #include memberitahuakan preprosesor untuk
menyertakan kode dari iostream, Berkas iostream berisi deklarasi untuk berbagai
fungsi yang dibutuhkan oleh perangkat lunak, atau class-class yang dibutuhkan
Baris
kedua :
void
main ()
Pernyataan
ini mendeklarasikan fungsi utama, bahwa suatu program C++ dapat berisi banyak
fungsi, yang harus selalu memiliki sebuah fungsi utama (main function), Fungsi
adalah modul yang berisi kode-kode untuk menyelesaikan masalah-masalah
tertentu. Kata Void menandakan fungsi main tidak bertipe.
Baris
ketiga :
{
Kurung
kurawal buka menandakan awal program.
Baris
keempat :
cout
Cout << “Hello world\n”;
Cout
adalah sebuah object dari Pustaka perangkat lunak standart C++ yang digunakan
untuk mencetak string ke piranti output standart, yang biasanya adalah layar
komputer, Compiler menghubungkan kode dari pustaka perangkat lunak standar itu
dengan kode yang telah ditulis untuk mendapatkan hasil executable, Tanda
\n
adalah
format modifier yang digunakan untuk bergabti baris setelah menampilkan string,
jika ada cout lain pada program tersebut, maka string yang menyertainya akan
dituliskan pada baris bawahnya. Baris kelima:
}
In English Language
"Understanding C++ Program"
C + + is a computer programming language C + + was developed at Bell Labs (Bjarne Stroustrup) in the early 1970s, the language is derived from the previous language, the BCL, At first, the language is designed as a programming language that runs on Unix systems, the development, version ANSI (American National Standards Institute) C programming language is a version of the dominant, though the version is now rarely used in the development of systems and networks as well as for embedded systems, Bjarne Stroustrup at Bell Labs first developed C + + in the early 1980s, to support features in C + +, built efficiency and system support for low-level programming (low-level coding). In the C + + added new concepts like class with its properties such as inheritance and overloading. One of the most fundamental differences with the C language is support for the concept of object-oriented programming (Object Oriented Programming).
Differences between programming languages C and C + + though these languages use the same syntax, but they have differences, C is a procedural programming languages, where the resolution of a problem is done by dividing the problem into the su-subproblems of smaller, In addition, C + + is a programming language that has the properties of Object-oriented programming, to solve the problem, C + + do the first step to explain the classes that a child class previously created as an abstraction from objects of physical, Class contains the state of the object, its members and the ability of objectnya, After Class is created and then solved the problem with the Class.
Example C + + Program
Examples of simple C + + program to hello world by using C + + Library Association can be seen below:
# Include
void main ()
{
Cout << "hello world \ n";
}
Description:
The first line:
# Include
As part of the compiler, c + + compiler from running a program called the preprocessor. Preprocessor has the ability to add and remove code from the source, in the # include preprocessor to include code memberitahuakan of iostream, iostream file contains declarations for the various functions required by the software, or classes needed
Second row:
void main ()
This statement declares the main function, that of a C + + program can contain many functions, which should always have a main function (main function), function is a module that contains the codes to solve specific problems. Void word signifies not the main function of type.
Third row:
{
Opening curly brace indicates the beginning of the program.
Fourth row:
cout cout << "Hello world \ n";
Cout is an object of the Reader software C + + standard that is used to print a string to standard output devices, which typically is a computer screen, Compiler link the code of standard software library with code that has been written to get the executable, Signs
\ N
format modifier is used to bergabti line after displaying the string, if any other court in the program, then the string attached to them will be written on the bottom line. Fifth row:
}
In English Language
"Understanding C++ Program"
C + + is a computer programming language C + + was developed at Bell Labs (Bjarne Stroustrup) in the early 1970s, the language is derived from the previous language, the BCL, At first, the language is designed as a programming language that runs on Unix systems, the development, version ANSI (American National Standards Institute) C programming language is a version of the dominant, though the version is now rarely used in the development of systems and networks as well as for embedded systems, Bjarne Stroustrup at Bell Labs first developed C + + in the early 1980s, to support features in C + +, built efficiency and system support for low-level programming (low-level coding). In the C + + added new concepts like class with its properties such as inheritance and overloading. One of the most fundamental differences with the C language is support for the concept of object-oriented programming (Object Oriented Programming).
Differences between programming languages C and C + + though these languages use the same syntax, but they have differences, C is a procedural programming languages, where the resolution of a problem is done by dividing the problem into the su-subproblems of smaller, In addition, C + + is a programming language that has the properties of Object-oriented programming, to solve the problem, C + + do the first step to explain the classes that a child class previously created as an abstraction from objects of physical, Class contains the state of the object, its members and the ability of objectnya, After Class is created and then solved the problem with the Class.
Example C + + Program
Examples of simple C + + program to hello world by using C + + Library Association can be seen below:
# Include
void main ()
{
Cout << "hello world \ n";
}
Description:
The first line:
# Include
As part of the compiler, c + + compiler from running a program called the preprocessor. Preprocessor has the ability to add and remove code from the source, in the # include preprocessor to include code memberitahuakan of iostream, iostream file contains declarations for the various functions required by the software, or classes needed
Second row:
void main ()
This statement declares the main function, that of a C + + program can contain many functions, which should always have a main function (main function), function is a module that contains the codes to solve specific problems. Void word signifies not the main function of type.
Third row:
{
Opening curly brace indicates the beginning of the program.
Fourth row:
cout cout << "Hello world \ n";
Cout is an object of the Reader software C + + standard that is used to print a string to standard output devices, which typically is a computer screen, Compiler link the code of standard software library with code that has been written to get the executable, Signs
\ N
format modifier is used to bergabti line after displaying the string, if any other court in the program, then the string attached to them will be written on the bottom line. Fifth row:
}