Fading Coder

One Final Commit for the Last Sprint

Enumerating Serial Ports and Handling Hardware Changes via Win32 APIs

Enumerating Ports via the SetupAPI The SetupAPI provides a structured way to query hardware devices currently present on the system. By targeting the GUID_DEVCLASS_PORTS class GUID, developers can retrieve both the logical port identifier and the associated hardware description. std::vector<std::...

Implementing High-DPI Aware Bar Charts with QCustomPlot

Core Architecture and Scaling Strategy QCustomPlot (QCP) is a lightweight, standalone Qt plotting library renowned for its modularity and layer-based rendering pipeline. When building desktop applications that require crisp vector graphics and sharp typography, standard UI toolkits often struggle wi...

Advanced Algorithmic Patterns: Sorting, Binary Search, and Greedy Strategies

Sorting with Custom Logic The standard library function std::sort is a highly efficient tool for ordering data, typically implementing a variation of quicksort with a time complexity of O(n log n). While it is defined in the <algorithm> header, it is commonly accessed via <bits/stdc++.h>...

Hash Table and Two-Pointer Techniques for K-Sum Problems

4Sum II: Pair Summation with Hash Maps Given four integer arrays of equal length, determine the number of tuple combinations (i, j, k, l) where the sum of corresponding elements equals zero. Unlike single-array k-sum problems requiring deduplication, this scenario involves four independent collectio...

Implementing UDP Unicast, Broadcast, and Multicast in Qt

Overview of UDP Communication Modes User Datagram Protocol (UDP) is a connectionless and unreliable protocol. In Qt development, implementing UDP requires understanding three primary transmission modes: Unicast, Broadcast, and Multicast. Effective implementation often depends on how network interfac...

Building Template-Driven Hash Containers in C++: From Core Implementation to Standard-Like Wrappers

Core Bucket Architecture Hash tables relying on chaining require a lightweight link node structure. Each node stores the payload and a pointer to the subsequent element within the same collision bucket. template <typename Payload> struct ChainLink { Payload data; ChainLink* next_node; ChainLin...

C++ Variable Types and Data Storage Fundamentals

Basic Variables Variable Naming Conventions C++ encourages meaningful variable names that follow specific naming conventions: Names can only contain alphabetic characters, digits, and underscores (_) The first character cannot be a digit Case sensitivity applies (uppercase and lowercase differ) C++...

C++ Multiple Inheritance Memory Layout and the Necessity of Virtual Destructors

Class Hierarchy and Memory Layout Consider the following class definitions: class CBase { public: int Data; CBase() = default; ~CBase(); }; class CTEST { private: int PrivateData1; int PrivateData2; public: int Data; CTEST() = default; ~CTEST(); void PrintData(); }; class CTest2 : public CBase, publ...

Recursive Algorithm Implementations in C++

Collatz Conjecture Verification The Collatz conjecture states that for any positive integer, if it's even divide by 2, if it's odd multiply by 3 and add 1, eventually the sequence will reach 1. This program calculates the number of steps required. #include <iostream> using namespace std; int c...

Printing Payment Program v1.1 with Delivery Service

This program optimizes some code from the original v1.0. Considering market adaptability, a delivrey service has been added. Charges range from 0.5 to 2.1 yuan based on distance from the starting point to the destination. To better serve student consumers, I will continue updating this system. Feel...