IGOS Nusantara dan C Plus Plus: Perbedaan revisi
Dari IGNwiki
(2 revisi antara oleh pengguna yang sama tidak ditampilkan) | |||
Baris 7: | Baris 7: | ||
== Contoh Program == | == Contoh Program == | ||
Simpan di /home/igos/cpp/coba.cpp | Simpan di /home/igos/cpp/coba.cpp | ||
+ | |||
+ | $ | ||
+ | mkdir /home/igos/cpp/ | ||
+ | cd /home/igos/cpp | ||
+ | nano coba.cpp | ||
+ | |||
+ | Ketik: | ||
#include <iostream> | #include <iostream> | ||
Baris 12: | Baris 19: | ||
int main() | int main() | ||
{ | { | ||
− | std::cout << " | + | std::cout << "Halo Dunia!" << std::endl; |
return 0; | return 0; | ||
} | } | ||
Baris 23: | Baris 30: | ||
$ | $ | ||
./hasil | ./hasil | ||
− | + | Halo Dunia! |
Revisi terkini pada 27 Agustus 2014 01.19
Daftar isi
Pasang
Lakukan
# yum -y install gcc-c++
Contoh Program
Simpan di /home/igos/cpp/coba.cpp
$ mkdir /home/igos/cpp/ cd /home/igos/cpp nano coba.cpp
Ketik:
#include <iostream> int main() { std::cout << "Halo Dunia!" << std::endl; return 0; }
Kompilasi coba.cpp
$ g++ coba.cpp -o hasil
Jalankan
$ ./hasil Halo Dunia!