When declaring variables inside a case block of a switch statement, specific compiler behaviors in C and C++ must be considered. The following code illustrates a commmon issue: switch (input_value) { case FIRST_CASE: int local_var = 100; case SECOND_CASE: // Additional code break; default: // Defaul...
Problem Description LeetCode Problem Link: 707. Design Linked List You can choose to use a singly linked list or a doubly linked list to design and implement your own linked list. A node in a singly linked list should have two attributes: val and next. val is the value of the current node, and next...
Win32/Registry-based approach Direct Win32 calls and registry queries provide fast access to operating system and hardware metadata. The code below wraps commonly used queries (OS/service pack, CPU, memory, NICs, disks, GPU). SystemProbe.h #pragma once #include <afxtempl.h> class SystemProbe {...
The program below opens an RTSP source, probes its streams, and remuxes packets direct to an FLV file without decoding. Timestamps are rescaled to the destination time base and packets are interleaved before writing. Initialize FFmpeg networking and open the input with RTSP options (e.g., TCP transp...
Streaming XML in Qt with QXmlStreamReader and QXmlStreamWriter aligns with SAX-style processing: data is consumed sequentially without building an in-memory tree. Compared to the legacy DOM and SAX APIs, the streaming classes are lighter, faster for large documents, and still easy to use for both re...
Project setup in Visual Studio File → New → Project Select "Installed" → "C++" → "Windows Desktop" → "Windows Desktop Wizard" (or "Win32 Project" on older VS) Name the project (for example, MinimalWin32App) Choose "Windows application" and...
C++ OpenGL/GLUT programs render to a window created and driven by GLUT’s event loop. OpenGL performs drawing; GLUT supplies cross‑platform windowing, input, and callbacks. Install GLUT (Ubuntu/Debian): sudo apt-get update && sudo apt-get install freeglut3 freeglut3-dev A minimal GLUT program...
TCP Chat over a Local Network Minimal TCP Echo Server (C) #include <arpa/inet.h> #include <errno.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h&...
User interface uses QWidget as the top-level window, QLineEdit to show and edit the expression/result, and QPushButton for keypad input. Normalize user input as it’s typed to simplify later evaluation. Parentheses are tracked sothat a closing parenthesis is only allowed when a matching opening paren...
AES (Advanced Encryption Standard, Rijndeal) is a symmetric block cipher standardized in FIPS-197. It operates on 128-bit blocks and supports key sizes of 128, 192, or 256 bits. This guide focuses on AES-128 and shows a clean C++ implementation of the key schedule (key expansion), block encryption/d...