keep it simple, stupid

导航

2011年8月15日 #

类模板之队列

摘要: // Queue.h#ifndef _QUEUE_H_#define _QUEUE_H_template<class T>class Queue{public: Queue(int size = 10); ~Queue(); bool IsEmpty() const; bool IsFull() const; T First() const; T Last() const; Queue<T>& Add(const T &x); Queue<T>& Delete(T &x);private: int front; int rea 阅读全文

posted @ 2011-08-15 10:11 tujiaw 阅读(234) 评论(0) 推荐(0)

2011年8月13日 #

The Road Not Taken(未选择的路)

摘要: 原文:The Road Not Taken byRobert Frost(弗罗斯特) writen by Robert Lee Frostsai.Two roads diverged in a yellow wood,And sorry I could not travel bothAnd be one traveler, long I stoodAnd looked down one as far as I couldTo where it bent in the undergrowth.Then took the other, as just as fair,And having pe.. 阅读全文

posted @ 2011-08-13 00:25 tujiaw 阅读(1252) 评论(0) 推荐(0)

2011年8月12日 #

常见排序算法

摘要: /*插入排序*/#include <iostream>using namespace std;template <class T>void SWAP(T &x, T &y){ T t; t = x; x = y; y = t;}template <class T>void Insert(T a[], int n, const T x){ int i; for (i = n-1; i >= 0 && x < a[i]; i--) { a[i+1] = a[i]; } a[i+1] = x;}template < 阅读全文

posted @ 2011-08-12 16:31 tujiaw 阅读(163) 评论(0) 推荐(0)

类模板之单链表

摘要: // Chain.h#ifndef _CHAIN_H_#define _CHAIN_H_template<class T>class ChainNode{public: T data; ChainNode<T> *link;};template<class T>class Chain{public: Chain(); ~Chain(); bool IsEmpty() const; int Length() const; bool Find(int index, T &value) const; int Search(T value) const; C 阅读全文

posted @ 2011-08-12 16:02 tujiaw 阅读(151) 评论(0) 推荐(0)

2011年8月10日 #

统计程序实例的个数

摘要: /**********windows核心编程实例17-AppInst**********//***展示:应用程序如何知道在任一时刻有多少个自己的实例正在运行***/#include <windows.h>#include "resource.h"int g_uMsgAppInstCountUpdate = WM_APP + 123;#pragma data_seg("Shared")volatile LONG g_lApplicationInstances = 0;#pragma data_seg()#pragma comment(linke 阅读全文

posted @ 2011-08-10 17:28 tujiaw 阅读(201) 评论(0) 推荐(0)

用内存映射的方式在文件末尾追加一个hello

摘要: #include <windows.h>#include <iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ HANDLE hFile = CreateFile("one.dat", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, NULL); if (hFile == INVALID_HANDLE_VALUE) { cout &l 阅读全文

posted @ 2011-08-10 17:22 tujiaw 阅读(218) 评论(0) 推荐(0)

6个故事:都体会了你就是营销超人!

摘要: 1、割草的男孩(哲理故事) 一个替人割草打工的男孩打电话给一位陈太太说:“您需不需要割草?” 陈太太回答说:“不需要了,我已有了割草工。” 男孩又说:“我会帮您拔掉花丛中的杂草。” 陈太太回答:“我的割草工也做了。” 男孩又说:“我会帮您把草与走道的四周割齐。” 陈太太说:“我请的那人也已做了,谢谢你,我不需要新的割草工人。” 男孩便挂了电话,此时男孩的室友问他说:“你不是就在陈太太那割草打工吗?为什么还要打这电话?” 男孩说:“我只是想知道我做得有多好!”感想: 1.我认为这个故事反映的ISO的第一个思想,即以顾客为关注焦点,不断地探询顾客的评价,我们才有可能知道自己的... 阅读全文

posted @ 2011-08-10 13:01 tujiaw 阅读(159) 评论(0) 推荐(0)

职场生存七大勇气不可少

摘要: 职业就像我们生活的台阶,我们需要在不同的时段站在不同的位置和高度。它已经不是毕业时的一锤定音,也不是郁闷难耐时的频频跳槽,它需要终生的策划。 突破现状的勇气 上班族面对每天的工作,总是会渐渐形成一种习惯,从好的一方面来说,这表示我们对工作逐渐上手、越来越熟练了,碰到各种状况都知道应该如何去处理;但是从另一个角度来看,如果我们每天面对每一个状况,都是用同一种思考模式、同一种方式来处理,很可能我们会成为整个团队往前迈进的障碍。 所以,我们应该建立自我挑战的习惯,常常自我挑战,别人还没有要求你改变,你自己就已经在那里求新求变了。 追求卓越的勇气 最近有一本书在中国相当流行,那就是《从A到A... 阅读全文

posted @ 2011-08-10 12:56 tujiaw 阅读(123) 评论(0) 推荐(0)

2011年8月8日 #

常用CRT字符串函数源码

摘要: ////////////////////memcpy/////////////////////////void * __cdecl memcpy ( void * dst, const void * src, size_t count ){ void * ret = dst; while (count--) { *(char *)dst = *(char *)src; dst = (char *)dst + 1; src ... 阅读全文

posted @ 2011-08-08 15:38 tujiaw 阅读(334) 评论(0) 推荐(0)

多列快速排序

摘要: #include <stdio.h>#include <stdlib.h>#define SIZE 100 //元素个数void swap(int *x,int *y) //交换两个元素{ int temp; temp=*x; *x=*y; *y=temp;}int partition(int list[],int low,int high,int step) //进行第一次排序{ int flag=list[low]; ... 阅读全文

posted @ 2011-08-08 09:30 tujiaw 阅读(209) 评论(0) 推荐(0)