Skip to content

Instantly share code, notes, and snippets.

View ardhiesta's full-sized avatar

ardhi wijayanto ardhiesta

View GitHub Profile
@ardhiesta
ardhiesta / double-paranthesis.c
Created June 14, 2023 04:27
example code to detect double paranthesis using C
#include <stdio.h>
// for example we'll evaluate string contains 8 characters
// change it if you want to evaluate longer string
int MAXSIZE = 8;
char stack[8];
int top = -1;
/* Check if the stack is empty */
int isempty(){
if(top == -1)
@ardhiesta
ardhiesta / ClassA.java
Created September 22, 2021 08:24
contoh source code Java yang memuat inheritance
public class ClassA{
public int x = 20;
public void show(){
System.out.println("Hello from ClassA");
}
public static void main(String args[]){
ClassB cb = new ClassB();
System.out.println(cb.x); //2. Apa output yang didapatkan dari baris ini
@ardhiesta
ardhiesta / ClassA.cpp
Created September 22, 2021 08:12
contoh source code yang memuat konsep inheritance / pewarisan
//contoh kode program berikut memuat implementasi konsep inheritance / pewarisan
#include <iostream>
using namespace std;
class ClassA
{
public:
int x = 20;
@ardhiesta
ardhiesta / main.kt
Created January 23, 2021 22:38
inisialisasi class dengan primary constructor
fun main(args: Array<String>) {
val mahasiswa = Mahasiswa("M0501001", "Danzo Karto", "Uhuygakure")
mahasiswa.showMahasiswa()
}
@ardhiesta
ardhiesta / Mahasiswa.kt
Created January 23, 2021 22:37
class Mahasiswa dengan primary constructor
class Mahasiswa(val nim: String, val nama: String, val alamat: String) {
fun showMahasiswa(){
println("nim: "+nim)
println("nama: "+nama)
println("alamat: "+alamat)
}
}
@ardhiesta
ardhiesta / main.kt
Created January 23, 2021 22:16
contoh main function Kotlin
fun main(args: Array<String>) {
val mahasiswa = Mahasiswa()
mahasiswa.showMahasiswa()
}
@ardhiesta
ardhiesta / Mahasiswa.kt
Created January 23, 2021 21:51
class Mahasiswa dalam bahasa Kotlin
class Mahasiswa {
var nim: String = "M0501001"
var nama: String = "Uzumaki Saburo"
var alamat: String = "Konohagakure"
fun showMahasiswa(){
println("nim: "+nim)
println("nama: "+nama)
println("alamat: "+alamat)
}
@ardhiesta
ardhiesta / main.lua
Created July 24, 2020 13:08
contoh program game dengan framework Love2D | bagian 0
--[[
Remake Game Pong
pong-0
"The Day-0 Update"
-- Program Utama --
Penulis kode : Colton Ogden
cogden@cs50.harvard.edu
@ardhiesta
ardhiesta / main.lua
Last active July 24, 2020 13:14
contoh program game dengan framework Love2D
--[[
Remake Game Pong
pong-0
"The Day-0 Update"
-- Program Utama --
Penulis kode : Colton Ogden
cogden@cs50.harvard.edu
@ardhiesta
ardhiesta / push.lua
Created July 24, 2020 11:42
push is a simple resolution-handling library that allows you to focus on making your game with a fixed resolution. (https://github.com/Ulydev/push/)
-- push is a simple resolution-handling library that allows you to focus on making your game with a fixed resolution.
-- https://github.com/Ulydev/push/
-- push.lua v0.3
-- Copyright (c) 2018 Ulysse Ramage
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HO