C++ - Chapter 1: Introduction

1. Introduction C++ was developed as an extension to C. It adds man few features to the C language, and tis perhaps best through of as a superset of C. Step 1: Define the problem that you would like to solve I want to write a program that will … Step 2: Determine how you are going to solve the problem Determine how we are going to solve the problem you came up with in step 1. ...

May 24, 2026 · 8 min · Phong Nguyen

C++ - Chapter 2: Fundamentals

C++ Basic Concepts Data is any information processed or stored by a computer. A Value is a specific piece of data (e.g. 42, 'A', 3.14). An Object is a region of storage (memory) with a type and a value. A Variable is a named object used to store data. Initialization is the process of giving an initial value to an object or variable. Literals: fixed values like 42, 3.14, ‘A’, “Hello”, true, nullptr. Operators: symbols that act on values (+ - * / %, == != < >, && || !, = += -=, etc.). An Expression is a combination of operators, constants and variables that evaluate to a value. A function is a reusable block of code that performs a specific task. 1. Initialization C++ provides several ways to initialize objects. Each form has different semantics and use cases. ...

May 24, 2026 · 10 min · Phong Nguyen

Cpp

See plus plus :) . Refer Introduce Fundamentals String 11. Scope, duration, and linkage summary A variable’s duration determines when it is created and destroyed. Variables with automatic duration: are created at the point of definition, and destroyed when the block they are part of is exited. This includes: - Local variables - Function parameters Variables with static duration: are created when the program begins and destroyed when the program ends. This includes: - Global variables - Static local variables Variables with dynamic duration: are created and destroyed by programmer request. This includes: - Dynamically allocated variables ...

February 9, 2025 · 85 min · Phong Nguyen

GTK4

Gtk4 with Cpp. References: Gtk 1. Introduction Gtk4 is a widget toolkit for creating graphical user interface (UI). It works on many UNIX-like platform, Windows and Macos. 2. Setup the environment Note: - This is the guides for Windows machine using Windows Subsystem for Linux (WSL). - [W]: The action will be performed on Windows Machine. - [U]: The action will be performed on WSL (in my case, it named "Ubuntu") on the host Windows Machine. - (Guides: ...): The reference link that I refer the step. - (Not try yet): This is referred from the guides but I was not in that case, so that I could not try. ------------------------------- A. Installing from packages ------------------------------- 1. [L] Install required packages. 1.1. [L] Debian/Ubuntu: sudo apt install libgtk-4-1 libgtk-4-dev gtk-4-examples 2. [L] Verify installation. 2.1. [L] gtk version - Run: pkg-config --modversion gtk4 2.2. [L] examples - Run: gtk4-demo ------------------------------- B. (Optional) Build from Source ------------------------------- 1. [L] Install build tools. 1.1. [L] sudo apt install build-essential meson ninja-build \ libglib2.0-dev libpango1.0-dev libgdk-pixbuf-2.0-dev \ libatk1.0-dev libepoxy-dev libgirepository1.0-dev 2. [L] Clone GTK source. 2.1. [L] git clone https://gitlab.gnome.org/GNOME/gtk.git 2.2. [L] cd gtk 3. [L] Build with Meson + Ninja. 3.1. [L] meson setup builddir 3.2. [L] ninja -C builddir 4. [L] (Optional) Install system-wide. 4.1. [L] sudo ninja -C builddir install 3. HelloWorld Create a new file named hello-world-gtk4.c with following content: #include <gtk/gtk.h> static void print_hello (GtkWidget *widget, gpointer data) { g_print ("Hello World\n"); } static void activate (GtkApplication *app, gpointer user_data) { GtkWidget *window; GtkWidget *button; window = gtk_application_window_new (app); gtk_window_set_title (GTK_WINDOW (window), "Hello"); gtk_window_set_default_size (GTK_WINDOW (window), 200, 200); button = gtk_button_new_with_label ("Hello World"); g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL); gtk_window_set_child (GTK_WINDOW (window), button); gtk_window_present (GTK_WINDOW (window)); } int main (int argc, char **argv) { GtkApplication *app; int status; app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return status; } - Hints: ...

August 21, 2025 · 2 min · Phong Nguyen