Last active
September 16, 2020 11:42
-
-
Save defrindr/2226ca3f63fdca2827d557bc39a129bf to your computer and use it in GitHub Desktop.
- Add PPA
sudo add-apt-repository ppa:codeblocks-devs/release
- Install Dependencies
sudo apt-get install build-essential
- Installing codeblocks
sudo apt install codeblocks codeblocks-contrib
if you have error like in below, when you build program , try step 4
-------------- Build file: "no target" in "no project" (compiler: unknown)---------------
g++ -c /home/nightsec/Documents/Kuliah/KP/praktikum_1/main.cpp -o /home/nightsec/Documents/Kuliah/KP/praktikum_1/main.o
g++ -o /home/nightsec/Documents/Kuliah/KP/praktikum_1/main /home/nightsec/Documents/Kuliah/KP/praktikum_1/main.o -lbgi-lgdi32-lcomdlg32-luuid-loleaut32-lole32 /home/nightsec/Documents/Kuliah/KP/Graphics-Library/libbgi.a
/usr/bin/ld: cannot find -lbgi-lgdi32-lcomdlg32-luuid-loleaut32-lole32
collect2: error: ld returned 1 exit status
- Remove default linker
Settings -> Compiler -> Global Compiler Settings -> Linker Settings
clear alllink libraries
andother linker options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
// nilai awal : | |
// a = 1 | |
// b = 2 | |
// c = 3 | |
// ekspektasi nilai : | |
// a = 4 | |
// b = 3 | |
// c = 5 | |
int a=1, b=2, c=3, d; | |
// cetak setiap variable | |
printf("a = %d", a) ; | |
printf("b = %d", b) ; | |
printf("c = %d", c) ; | |
// nilai baru setiap element didapatkan | |
// dari element itu sendiri ditambahkan | |
// element dibelakang nya | |
// contoh : | |
// a = a+c | |
// b = b+a | |
// c = c+b | |
d = a; | |
// simpan dahulu nilai a kedalam | |
// variable dummy | |
// d = 1 | |
a += c; | |
// a = a + c | |
// a = 1 + 3 | |
b += d; | |
// b = b + d | |
// b = 2 + 1 | |
c += b-d; | |
// c = c + b - c | |
// c = 3 + 3 - 1 | |
// kenapa b - d ?? karena untuk mendapatkan | |
// nilai asli dari b kita harus menguranginya | |
// kembali dengan d | |
// cetak variable akhir | |
printf("\n"); | |
printf("a = %d", a) ; | |
printf("b = %d", b) ; | |
printf("c = %d", c) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment