博文
SETPART.C(转载)(2006-06-12 09:12:00)
摘要:/* ------------------------------------------------------ *//* FUNCTION set_partition : *//* Given an integer n, this function will lists all *//* possible partitions of {1,2,3,...,n}. *//* *//* Copyright Ching-Kuang Shene July/24/1989 *//* ---------------------------......
PERMUT_R.C(转载)(2006-06-12 09:11:00)
摘要:/* ------------------------------------------------------ *//* PROGRAM permutation by rotation : *//* Give an integer n, this program generates all *//* possible permutations by using rotation operations. *//* *//* Copyright Ching-Kuang Shene July/08/1989 *//* ------------------------------------------------------ */
#include <stdio.h>#include <stdlib.h>
#defi......
PERMU_LR.C(转载)(2006-06-12 09:10:00)
摘要:#include <stdio.h>#include <stdlib.h>
#define LOOP 1#define SWAP(a,b) { int t; t = a; a = b; b = t; }#define REVERSE(a,b) { int i, j; \ for (i=(a), j=(b); i < j; i++, j--) \ SWAP(perm[i], perm[j]); \ }#define DISPLAY(n) { int i; ......
LEXICAL.C(转载)(2006-06-12 09:10:00)
摘要:/* ------------------------------------------------------ *//* PROGRAM All Possible Subset by Lexical Order : *//* This program generates all subsets by lexical order.*//* *//* Copyright Ching-Kuang Shene July/05/1989 *//* ------------------------------------------------------ */
#include <stdio.h>#include <stdlib.h>
#define MAXSIZE 20#define LOOP 1
void main(void){  ......
KSUBSET.C(转载)(2006-06-12 09:09:00)
摘要:/* ------------------------------------------------------ *//* PROGRAM Lexical Order of k-Subsets : *//* Given a n-element set {1,2,3,...,n} and a k <= n, *//* this program lists all k-element subsets of {1,2,..,n} *//* in lexical order. *//* *//* Copyright Ching-Kuang Shene &n......
INTPART.C(转载)(2006-06-12 09:08:00)
摘要:/* ------------------------------------------------------ *//* PROGRAM integer partition : *//* Given a positive integer n, this program lists all *//* partition of n in anti-lexical order. *//* *//* Copyright Ching-Kuang Shene July/21/1989 *//* ----------------------------------------------------......
INTPART#.C(转载)(2006-06-12 09:08:00)
摘要:/* ------------------------------------------------------ *//* FUNCTION int_part_no : *//* Given an integer n, this function computes the *//* number of partitions of the input integer. NOTE that *//* this function computes the number only and does not *//* generate the corresponding partition. For the second *//* purpose, see program INTPART.C please. *//*  ......
GRAYCODE.C(转载)(2006-06-12 09:07:00)
摘要:/* ------------------------------------------------------ *//* PROGRAM Subset Generation by Gray Code : *//* This program generates all possible subsets of a n *//* elements set with Gray Code. Simply speaking, the Gray*//* code of n bits is a sequence of n-bit strings such that*//* any two consecutive two bit strings have exactly one *//* position in difference. For example, for n = 3, the *//* gray code generated is the sequence 000,001,010,011, *//* 010,110,111,101 and 100. Therefore each item of this *//* sequence corresponds one subset as in the direct method*//* ......
DIRECT.C(转载)(2006-06-12 09:05:00)
摘要:/* ------------------------------------------------------ *//* PROGRAM Subset Listing : *//* This program lists all subsets, including empty set,*//* of a given set with elements {1,2,...,n} by using a *//* direct generation method. *//* *//* Copyright Ching-Kuang Shene &nbs......
图书管理(3)(2006-01-03 11:28:00)
摘要:#include <dos.h>#include <bios.h>#include <conio.h>#include <stdio.h>#include <stdlib.h>#include <math.h>#define LEFT 0x4b00#define RIGHT 0x4d00#define DOWN 0x5000#define UP 0x4800#define SPACE 0x3920#define ESC 0x011b#define ENTER 0x1c0d#define Backspace 0xe08 /*擦除键*/#define ALT_B 12288 /*组合键ALT_B */#define ALT_H 8960/*组合键ALT_H */int key;/*按键变量*/int textx,texty;/*光标坐标,x行,y列*/struct menustruct/*菜单用的结构体*/{ char name[10];/*主菜单名*/ char str[10][20];/*选项*/ int n;/*选项数*/}ml[2];typedef struct BookList/*书的结构体*/{ char num[20];/*图书编号*/ char name[20]; int price; int yes;/*判断书是否存在或者已经借出,1存在,0借出*/ struct BookList *next;}Book;char save[4096];/*保存文本区域空间*/char c[4096];/*清屏专用空间*/int i,j;void Menu();/*初始化界面*/void Selectitem();/*定义菜单*/void DrawSelectitem();/*显示主菜单*/void BlueText(int x,int y,char *z);/*选中菜单*/void RedText(int x,int y,char *z);/*正常菜单*/void Run();void DrawMl(int......
