链表的伪头节点

本文介绍C语言中,如何无中生有,给链表创造出一个不占空间的伪头节点

# 基本定义

设我们有一个不带空头节点的链表,其节点定义为

//typedef int dtype;
typedef struct node{
    dtype data;
    struct node *next;
} node;

链表定义为

typedef struct linklist{
    node *head;
    //...
} linklist;
more ...

24 Game Solver

24 game is an arithmetic game with a simple rule: Given 4 numbers and use + - * / to get 24.

  • A simple example is 1, 2, 3, 4, and you find 1*2*3*4=24
  • A more difficult one is 5, 5, 5, 1, the answer is 5*(5-(1/5))=24, which includes fractions.

24game project provides a powerful C++ solver for the 24 game. And you can play with the PyQt5 based graphical front end.

more ...


QtCreator使用小结

# Debug

首先要看使用的是什么构建系统:

  • qmake 不需要额外的设置
  • cmake Debug需要在生成配置的时候进行额外参数设置
  • qbs ???

QtC在左下角的Debug按钮一定要在Debug模式下运行才能有效。

进入Debug模式如果是qmake构建系统不需要额外配置。但是如果是cmake则每次都要重新生成配置。

参考Debug with cmake and qtcreator可知生成配置的时候应当添加参数-DCMAKE_BUILD_TYPE=Debug

# C++11

  • CMake: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  • qmake: QMAKE_CXXFLAGS += -std=c++0x
more ...