- 博客(14)
- 资源 (2)
- 收藏
- 关注
原创 基于SDK的Win32窗口创建
#include "stdafx.h" HINSTANCE g_hInstance = NULL; // 主窗口处理函数 LRESULT CALLBACK WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_
2014-08-10 21:49:38
739
原创 Unix聊天室案例 客户端+服务端
/* * 聊天室客户端 * */ #include #include #include #include #include #include #include #include #include int sockfd; char *IP = "127.0.0.1"; short PORT = 10222; typedef struct sockaddr SA; ch
2014-08-10 21:29:06
1076
原创 Unix Socket本地通讯示例
Client端:#include #include #include #include #include #include int main() { /* 1.socket */ int sockfd = socket(AF_UNIX,SOCK_DGRAM,0); if(sockfd==-1) perror("socket"),exit(-1); /* 2.通信地址 */
2014-08-10 21:19:34
869
原创 栈的颠倒算法 递归实现
#include // 栈结构体 typedef struct stock { int data[20]; int top; } stock; // 压入 void push(stock* s, int val) { s->data[s->top] = val; s->top++; } // 弹出 int pop(stock* s) { s->top++; re
2014-08-10 00:39:56
979
原创 单链表逆置算法递归实现
链表结构体:typedef struct node { int data; struct node* next; } node;
2014-08-10 00:19:05
2411
原创 C++ Log类 可获取常用硬件信息
#pragma once #include "StdAfx.h" #include class CLog { public: enum LogLevel // Log级别 { lvInfo = 0, // 一般 lvWarning = 1, // 警告 lvError = 2 // 错误 }; CLog (); ~CLog (); bool Open(LPCTST
2014-08-08 18:42:53
875
原创 牛顿逼近法求平方根
#include #include int main() { double n, x, last; printf("plz input the num:\n"); scanf("%lf", &n); printf("%g\n", n); x = n; // 猜测初始值 do { last = x; x = (x
2014-08-08 18:39:00
1972
原创 使用cpu的协处理器数学指令秒杀一切算法。。。
float _sqrt(float f){ __asm__( "fld %0\n" "fsqrt\n" "fstp %0" :"+g"(f) : :"memory" ); return f;}
2014-08-08 17:39:35
1206
原创 让DuiLib CheckBox支持全选、全不选、非全选三种状态
DuiLib官方库中的Checkbox只有Checked和Uncheck两种状态,但我们往往要实现这中需求: 显然,Checkbox自带的属性和方法都不能满足这种需求,这就需要我们自定义重写CheckBox控件。 其实选择状态还是只有2种,因为SetCheck(bool bCheck) 参数只能为true或者false。但我们可以重写CheckBox的 void PaintS
2014-08-08 07:53:12
7933
1
原创 让DuiLib支持Icon图片显示
#pragma once namespace DuiLib { ////////////////////////////////////////////////////////////////////////// // CIconUI class UILIB_API CIconUI : public DuiLib::CControlUI { friend class CIconWnd
2014-07-24 12:37:39
3819
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人