2012年7月18日

摘要: #include <windows.h>#include <stdio.h>#include <stdlib.h>#include <conio.h>//显示操作菜单void Menu(){ printf("\n\n\t1-------------------------设置鼠标为左手习惯\n"); printf("\t2-------------------------设置鼠标为右手习惯\n"); printf("\t3-------------------------获取键盘类型和功能键个数\ 阅读全文
posted @ 2012-07-18 09:29 NoSoul.Love 阅读(322) 评论(0) 推荐(0)

2012年6月21日

摘要: 先进先出(FIFO)淘汰算法#include <stdio.h>/*页表长度,实际上是由系统按照作业的长度决定的*/#define N 64#define LENGTH 10typedef struct{ int lnumber;/*页号*/ int flag;/*是否在主存中,1表示在,0表示不在*/ int pnumber;/*所在主存块的块号*/ int write;/*是否修改过,1表示修改过,0表示没修改过*/ int dnumber;/*磁盘块号*/} Page;/*页表定义*/Page page[N];int m;int page_length;in... 阅读全文
posted @ 2012-06-21 16:36 NoSoul.Love 阅读(424) 评论(2) 推荐(0)

2012年6月16日

摘要: #include <stdio.h>#include <windows.h>int tickets=30;/*临界区对象*/CRITICAL_SECTION g_csA,g_csB;/*线程数据信息*/DWORD WINAPI Fun1Proc(LPVOID lpParameter){ while(1) { /*进入临界区*/ EnterCriticalSection(&g_csA); Sleep(1); if(tickets>0) { EnterCriticalSection(&g_csB... 阅读全文
posted @ 2012-06-16 22:31 NoSoul.Love 阅读(210) 评论(0) 推荐(0)

2012年6月4日

摘要: #include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdbool.h>#include <windows.h>/*最大临界区数*/#define MAX_BUFFER_NUM 20/*秒到毫秒的乘法因子*/#define INTE_PER_SEC 1000/*生产与消费线程的总数*/#define MAX_THREAD_NUM 64/*每个线程的参数*/typedef struct{ int serial;/*线程序列号*/ char entity;/* 阅读全文
posted @ 2012-06-04 16:49 NoSoul.Love 阅读(303) 评论(0) 推荐(0)

2012年5月21日

摘要: #include <stdio.h>#include <stdlib.h>#include <string.h>#define MaxLength 1000char Str[MaxLength];char File[MaxLength];int main(){ int Cnt,Len,i,j; FILE *Fi; system("attrib *.c /s /d > file_list.txt"); //system("attrib *.? /s /d >> file_list.txt");/*?代表 阅读全文
posted @ 2012-05-21 15:56 NoSoul.Love 阅读(293) 评论(0) 推荐(0)

2012年4月2日

摘要: 边结构体:typedef struct{ int to; int next;} Edge;还需一个整型以及一个数组辅助变量。完整结构为:#define MaxV 100#define MaxE 10000typedef struct{ int to;/*当前边的终端点*/ int next;/*也是以当前边的初始点为初始点的、与当前边相邻的另一条边在E[]中的index*/} Edge;Edge E[MaxE];int Adj[MaxV];/*每个顶点的最后一条边*/int Size;/*边的条数*/Adj取英文中的Adjacent前3个字母,意为相邻。这儿存储... 阅读全文
posted @ 2012-04-02 15:18 NoSoul.Love 阅读(1880) 评论(0) 推荐(1)

2012年3月20日

摘要: Base64加密算法主要原理是根据3*8=4*6=24这一原理,由于ASCII码范围是0~127,二进制表示为0000 0000~0111 1111。所以3个8位的字符通过位运算能与4个6位(实际也是8位不过前2为全为0)的表示相同的内容。所以加密后的字符串要比源字符串多1/3。例如:源字符串(3个):0010 1101 0011 1010 0111 0110目标字符串(4个): 0000 1011 0001 0011 0010 1001 0011 0110当源字符串不足3个的时候,用全0来补足,转换后用=号来代替。迅雷的“专用地址”是用Base64加密。一、在地址的前后分别添加... 阅读全文
posted @ 2012-03-20 11:22 NoSoul.Love 阅读(345) 评论(0) 推荐(0)

2012年3月16日

摘要: 栈: 以先进后出的原则,先进栈的元素处于栈底,后进栈的元素处于栈顶,以一个指针作为标记就能很好的完成简单的入栈出栈操作代码如下:#include <stdio.h>#define N 10int Stack[N];//栈int Top;//栈顶指针void Stack_Push(int x)//入栈操作{ Stack[Top++]=x; return;}void Stack_Pop()//出栈操作{ printf("%d ",Stack[--Top]); return;}int main(){ int i,num; for(Top=i=0;i<N;++i) 阅读全文
posted @ 2012-03-16 14:13 NoSoul.Love 阅读(690) 评论(2) 推荐(0)

2012年3月11日

摘要: 1)检查 update 源是否存在并已启用 打开终端,选择root用户,输入以下命令: 检查update源是否存在并启用 2)更新当前系统 3)替换当前所有启用源 4)升级系统 OK! PS:不推荐最后一行命令直接输入:zypper dup 。直接输入“zypper dup”会使得逐一安装,当遇上断 阅读全文
posted @ 2012-03-11 13:14 NoSoul.Love 阅读(1397) 评论(0) 推荐(0)

2011年11月4日

摘要: #include <stdio.h>#include <math.h>#define N 9 //默认为9x9的数独typedef struct{ int x; int y;} Point;Point P[N*N];int A[N][N];int Cnt,Flag;void Init(){ int i,j; Cnt=Flag=0; char Str[N]; for(i=0;i<N;++i) { scanf("%s",Str); for(j=0;j<N;++j) { if(Str[j]=... 阅读全文
posted @ 2011-11-04 16:20 NoSoul.Love 阅读(516) 评论(1) 推荐(1)