├── 001.第一个C程序 └── 1.c ├── 002.运行多个源文件 ├── helloword.c ├── print.c └── print.h ├── 003.求整数之积 ├── 3.c └── TCTEMP.DAT ├── 004.比较实数大小 └── 4.c ├── 005.字符的输出 └── 5.C ├── 006.显示变量所占字节数 └── 6.C ├── 007.自增自减运算 └── 7.C ├── 008.数列求和 ├── 8.C └── TCTEMP.DAT ├── 009.乘法口诀表 ├── 9.c └── TCTEMP.DAT ├── 010.猜数字游戏 ├── 10.c └── TCTEMP.DAT ├── 011.模拟ATM(自动柜员机)界面 ├── 11.c └── TCTEMP.DAT ├── 012.用一维数组统计学生成绩 ├── 12.c └── TCTEMP.DAT ├── 013.用二维数组实现矩阵转置 ├── 13.c └── TCTEMP.DAT ├── 014.求解二维数组的最大最小元素 └── 14.C ├── 015.利用数组求前n个质数 ├── 15.c └── TCTEMP.DAT ├── 016.编制万年历 └── 16.c ├── 017.对数组元素排序 └── 17.c ├── 018.任意进制数的转换 └── 18.c ├── 019.判断回文数 ├── 19.c └── TCTEMP.DAT ├── 020.求数组前n元素之和 ├── 20.C └── TCTEMP.DAT ├── 021.求解钢材切割的最佳订单 └── 21.C ├── 022.通过指针比较整数大小 └── 22.C ├── 023.指向数组的指针 ├── 23.c └── TCTEMP.DAT ├── 024.寻找指定元素的指针 └── 24.c ├── 025.寻找相同元素的指针 └── 25.c ├── 026.阿拉伯数字转换为罗马数字 └── 26.c ├── 027.字符替换 └── 27.c ├── 028.从键盘读入实数 └── 28.c ├── 029.字符行排版 └── 29.c ├── 030.字符排列 └── 30.c ├── 031.判断字符串是否回文 └── 31.c ├── 032.通讯录的输入输出 └── 32.c ├── 033.扑克牌的结构表示 └── 33.c ├── 034.用“结构”统计学生成绩 └── 34.c ├── 035.报数游戏 └── 35.c ├── 036.模拟社会关系 └── 36.c ├── 037.统计文件的字符数 └── 37.C ├── 038.同时显示两个文件的内容 └── 38.C ├── 039.简单的文本编辑器 └── 39.C ├── 040.文件的字数统计程序 ├── 40.c └── WORDCNT.DAT ├── 041.学生成绩管理程序 ├── 41.c └── STUDENT.DAT ├── 042.插入排序 └── 42.c ├── 043.希尔排序 └── 43.c ├── 044.冒泡排序 └── 44.c ├── 045.快速排序 └── 45.c ├── 046.选择排序 └── 46.c ├── 047.堆排序 └── 47.c ├── 048.归并排序 └── 48.c ├── 049.基数排序 └── 49.C ├── 050.二叉搜索树操作 └── 50.C ├── 051.二项式系数递归 └── 51.C ├── 052.背包问题 └── 52.C ├── 053.顺序表插入和删除 └── 53.c ├── 054.链表操作(1) └── 54.c ├── 055.链表操作(2) └── 55.c ├── 056.单链表就地逆置 └── 56.c ├── 057.运动会分数统计 └── 57.c ├── 058.双链表 └── 58.c ├── 059.约瑟夫环 └── 59.c ├── 060.记录个人资料 └── 60.c ├── 061.二叉树遍利 └── 61.c ├── 062.浮点数转换为字符串 └── 62.c ├── 063.汉诺塔问题 └── 63.c ├── 064.哈夫曼编码 └── 64.c ├── 065.图的深度优先遍利 └── 65.C ├── 066.图的广度优先遍利 └── 66.C ├── 067.求解最优交通路径 └── 67.c ├── 068.八皇后问题 └── 68.c ├── 069.骑士巡游 └── 69.c ├── 070.用栈设置密码 └── 70.c ├── 071.魔王语言翻译 └── 71.c ├── 072.火车车厢重排 └── 72.c ├── 073.队列实例 └── 73.c ├── 074.K阶斐波那契序列 └── 74.c ├── 075.绘制余弦曲线和直线的迭加 └── 75.c ├── 076.计算高次方数的尾数 └── 76.c ├── 077.打鱼还是晒网 └── 77.c ├── 078.怎样存钱以获取最大利息 └── 78.c ├── 079.阿姆斯特朗数 └── 79.c ├── 080.亲密数 └── 80.c ├── 081.自守数 └── 81.c ├── 082.具有abcd=(ab+cd)2性质的数 └── 82.c ├── 083.验证歌德巴赫猜想 └── 83.c ├── 084.素数幻方 ├── 84.c └── exa70dat.dat ├── 085.百钱百鸡问题 └── 85.c ├── 086.爱因斯坦的数学题 └── 86.c ├── 087.三色球问题 └── 87.c ├── 088.马克思手稿中的数学题 └── 88.c ├── 089.配对新郎和新娘 └── 89.c ├── 090.约瑟夫问题 └── 90.c ├── 091.邮票组合 └── 91.C ├── 092.分糖果 └── 92.c ├── 093.波瓦松的分酒趣题 └── 93.C ├── 094.求π的近似值 └── 94.c ├── 095.奇数平方的有趣性质 └── 95.c ├── 096.角谷猜想 └── 96.C ├── 097.四方定理 └── 97.C ├── 098.卡布列克常数 └── 98.C ├── 099.尼科彻斯定理 └── 99.C ├── 100.扑克牌自动发牌 └── 100.C ├── 101.常胜将军 └── 101.C ├── 102.搬山游戏 └── 102.C ├── 103.兔子产子(菲波那契数列) └── 103.c ├── 104.数字移动 └── 104.C ├── 105.多项式乘法 └── 105.c ├── 106.产生随机数 └── 106.c ├── 107.堆栈四则运算 └── 107.c ├── 108.递归整数四则运算 └── 108.c ├── 109.复平面作图 └── 109.c ├── 110.绘制彩色抛物线 └── 110.c ├── 111.绘制正态分布曲线 └── 111.c ├── 112.求解非线性方程 └── 112.c ├── 113.实矩阵乘法运算 └── 113.c ├── 114.求解线性方程 └── 114.c ├── 115.n阶方阵求逆 └── 115.C ├── 116.复矩阵乘法 └── 116.C ├── 117.求定积分 └── 117.C ├── 118.求满足特异条件的数列 └── 118.C ├── 119.超长正整数的加法 └── 119.C ├── 120.绘制直线 └── 120.c ├── 121.绘制圆 └── 121.C ├── 122.绘制圆弧 └── 122.C ├── 123.绘制椭圆 └── 123.C ├── 124.设置背景色和前景色 └── 124.C ├── 125.设置线条类型 └── 125.C ├── 126.设置填充类型和填充颜色 └── 126.C ├── 127.图形文本的输出 └── 127.c ├── 128.金刚石图案 └── 128.C ├── 129.飘带图案 └── 129.C ├── 130.圆环图案 └── 130.C ├── 131.肾形图案 └── 131.C ├── 132.心脏形图案 └── 132.C ├── 133.渔网图案 └── 133.C ├── 134.沙丘图案 └── 134.C ├── 135.设置图形方式下的文本类型 └── 135.C ├── 136.绘制正多边形 └── 136.c ├── 137.正六边形螺旋图案 └── 137.C ├── 138.正方形螺旋拼块图案 └── 138.C ├── 139.图形法绘制圆 └── 139.C ├── 140.递归法绘制三角形图案 └── 140.C ├── 141.图形法绘制椭圆 └── 141.C ├── 142.抛物样条曲线 ├── 142.C └── EXA142.DAT ├── 143.Mandelbrot分形图案 └── 143.C ├── 144.绘制布朗运动曲线 └── 144.C ├── 145.艺术清屏 └── 145.C ├── 146.矩形区域的颜色填充 └── 146.C ├── 147.VGA256色模式编程 └── 147.C ├── 148.绘制蓝天图案 └── 148.C ├── 149.屏幕检测程序 ├── 149.C └── 149.DAT ├── 150.运动的小车动画 └── 150.C ├── 151.动态显示位图 ├── 151.C ├── 151.DAT └── 151.bmp ├── 152.利用图形页实现动画 └── 152.C ├── 153.图形时钟 └── 153.C ├── 154.音乐动画 └── 154.C ├── 155.读取DOS系统中的国家信息 └── 155.C ├── 156.修改环境变量 └── 156.C ├── 157.显示系统文件表 └── 157.C ├── 158.显示目录内容 └── 158.C ├── 159.读取磁盘文件 └── 159.C ├── 160.删除目录树 └── 160.C ├── 161.定义文本模式 └── 161.C ├── 162.设计立体窗口 └── 162.C ├── 163.彩色弹出菜单 └── 163.C ├── 164.读取CMOS信息 └── 164.C ├── 165.获取BIOS设备列表 └── 165.C ├── 166.锁住硬盘 └── 166.C ├── 167.备份恢复硬盘分区表 └── 167.C ├── 168.设计口令程序 └── 168.C ├── 169.程序自我保护 └── 169.C ├── 170.水果拼盘 └── 170.C ├── 171.小孩吃梨 └── 171.C ├── 172.删除字符串中的特定字符 └── 172.C ├── 173.求解符号方程 └── 173.C ├── 174.计算标准差 └── 174.C ├── 175.求取符合特定要求的素数 ├── 175.C ├── IN175.DAT └── OUT1715.DAT ├── 176.统计符合特定条件的数 ├── 176.C ├── IN176.DAT └── OUT176.DAT ├── 177.字符串倒置 ├── 177.C ├── IN177.DAT └── OUT177.DAT ├── 178.部分排序 ├── 178.C ├── IN178.DAT └── OUT178.DAT ├── 179.产品销售记录处理 ├── 179.C ├── IN179.DAT └── OUT179.DAT ├── 180.特定要求的字符编码 ├── 180.C ├── IN180.DAT └── OUT180.DAT ├── 181.求解三角方程 ├── 181.C ├── IN181.DAT └── OUT181.DAT ├── 182.新完全平方数 ├── 182.C └── OUT182.DAT ├── 183.三重回文数 ├── 183.C └── OUT183.DAT ├── 184.奇数方差 ├── 184.C └── OUT184.DAT ├── 185.统计选票 ├── 185.C ├── IN185.DAT └── OUT185.DAT ├── 186.同时整除 ├── 186.C └── OUT186.DAT ├── 187.字符左右排序 ├── 187.C ├── IN187.DAT └── OUT187.DAT ├── 188.符号算式求解 ├── 188.C └── OUT188.DAT ├── 189.数字移位 ├── 189.C ├── IN189.DAT └── OUT189.DAT ├── 190.统计最高成绩 ├── 190.C ├── IN190.DAT └── OUT190.DAT ├── 191.比较字符串长度 └── 191.C ├── 192.合并整数 └── 192.C ├── 193.矩阵逆置 └── 193.C ├── 194.删除指定的字符 └── 194.C ├── 195.括号匹配 └── 195.C ├── 196.字符串逆置 └── 196.C ├── 197.SIX、NINE问题 └── 197.C ├── 198.单词个数统计 └── 198.C ├── 199.方差运算 └── 199.C ├── 200.级数运算 └── 200.C ├── 201.输出素数 └── 201.C ├── 202.素数题 └── 202.C ├── 203.序列排序 └── 203.C ├── 204.整数各位数字排序 └── 204.C ├── 205.字符串字母移位 └── 205.C ├── 206.Fibonacc数列 ├── 206.C └── OUT206.DAT ├── 207.商人过河游戏 └── 207.C ├── 208.吃数游戏 └── 208.C ├── 209.解救人质游戏 └── 209.C ├── 210.打字训练游戏 ├── 210.C ├── english.dat ├── others.dat └── typeall.dat ├── 211.双人竞走游戏 └── 211.C ├── 212.迷宫探险游戏 └── 212.C ├── 213.迷你撞球游戏 ├── 213.C └── record.dat ├── 214.模拟扫雷游戏 ├── 214.C └── SCORE.DAT ├── 215.推箱子游戏 └── 215.C ├── 216.五子棋游戏 └── 216.C ├── 217.综合CAD系统 ├── BALLOON.DWG ├── CATALOG ├── FE.COM ├── HIGHRES.FNT ├── MATRIX.FNT ├── MCDRAW.C ├── MCDRAW.COM ├── MCPRINT.C ├── MCPRINT.COM ├── MICROCAD.C ├── MICROCAD.COM ├── MICROCAD.DWG ├── MICROCAD.FNT ├── ROAD.DWG ├── TCCONFIG.TC ├── THINLINE.FNT ├── TRAIN.DWG ├── WAGON.DWG ├── WIDGET.DWG └── readme.txt ├── 218.功能强大的文本编辑器 ├── BLOCK.C ├── CFGCOLOR.C ├── CFGCOLOR.H ├── CFGFILE.C ├── CFGFILE.H ├── CFGHELP.C ├── CFGHELP.H ├── CFGKEYS.C ├── CFGKEYS.H ├── CFGMACRO.C ├── CFGMACRO.H ├── CFGMODES.C ├── CFGMODES.H ├── COMMON.H ├── CONSOLE.C ├── CRITERR.C ├── CRITERR.H ├── DEFAULT.H ├── DEFINE.H ├── DESC.SDI ├── DIFF.C ├── DIRLIST.C ├── ED.C ├── FILE.C ├── FILE_ID.DIZ ├── FINDREP.C ├── GLOBAL.H ├── HELP.H ├── HWIND.C ├── INT24.ASM ├── LIU ├── MACRO.C ├── MAIN.C ├── MAKECFG ├── MAKETDE ├── PORT.C ├── PROMPTS.H ├── READ_ME.TDE ├── REGX.C ├── SIMUL101.ASM ├── SORT.C ├── TAB.C ├── TDE.CFG ├── TDE.PRJ ├── TDEASM.C ├── TDECFG.C ├── TDECFG.H ├── TDEFUNC.H ├── TDESTR.H ├── UTILS.C ├── WINDOW.C ├── WORDWRAP.C └── readme.txt ├── 219.图书管理系统 └── Library.c ├── 220.进销存管理系统 ├── 220.C ├── SHOP.DAT └── TCTEMP.DAT └── README.md /001.第一个C程序/1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/001.第一个C程序/1.c -------------------------------------------------------------------------------- /002.运行多个源文件/helloword.c: -------------------------------------------------------------------------------- 1 | #include "print.h" 2 | 3 | int main(void){ 4 | printHello(); 5 | return 0; 6 | } -------------------------------------------------------------------------------- /002.运行多个源文件/print.c: -------------------------------------------------------------------------------- 1 | #include "print.h" 2 | 3 | void printHello() 4 | { 5 | printf("hello word!\n"); 6 | } -------------------------------------------------------------------------------- /002.运行多个源文件/print.h: -------------------------------------------------------------------------------- 1 | #include "stdio.h" 2 | 3 | void printHello(void); -------------------------------------------------------------------------------- /003.求整数之积/3.c: -------------------------------------------------------------------------------- 1 | /* Input two numbers, output the product */ 2 | #include 3 | main() 4 | { 5 | int x,y,m; /* 定义整型变量x,y,m */ 6 | printf("Please input x and y\n"); /* 输出提示信息 */ 7 | scanf("%d%d",&x,&y); /* 读入两个乘数,赋给x,y变量 */ 8 | m=x*y; /* 计算两个乘数的积,赋给变量m */ 9 | printf("%d * %d = %d\n",x,y,m); /* 输出结果 */ 10 | } 11 | -------------------------------------------------------------------------------- /003.求整数之积/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /004.比较实数大小/4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/004.比较实数大小/4.c -------------------------------------------------------------------------------- /005.字符的输出/5.C: -------------------------------------------------------------------------------- 1 | /* */ 2 | #include 3 | main() 4 | { 5 | char ch,nch; /* */ 6 | int count; /* */ 7 | int k; /* */ 8 | 9 | printf("Please input a string with a # in the end.\n"); 10 | scanf("%c",&ch); /* */ 11 | while(ch != '#') /* */ 12 | { 13 | if(ch >= '0' && ch <= '9') 14 | { 15 | /* */ 16 | count = ch-'0'+1; /* */ 17 | scanf("%c",&nch); /* */ 18 | for(k=0;k 3 | main() 4 | { 5 | int a=5,b,c,i=10; 6 | b=a++; 7 | c=++b; 8 | 9 | printf("a = %d, b = %d, c = %d\n",a,b,c); 10 | printf("i,i++,i++ = %d,%d,%d\n",i,i++,i++); 11 | printf("%d\n",++i); 12 | printf("%d\n",--i); 13 | printf("%d\n",i++); 14 | printf("%d\n",i--); 15 | printf("%d\n",-i++); 16 | printf("%d\n",-i--); 17 | getchar(); 18 | } -------------------------------------------------------------------------------- /008.数列求和/8.C: -------------------------------------------------------------------------------- 1 | #include 2 | main() 3 | { 4 | int i,j,n; 5 | long sum=0,temp=0; 6 | 7 | printf("Please input a number to n:\n"); 8 | scanf("%d",&n); 9 | if(n<1) 10 | { 11 | printf("The n must no less than 1!\n"); 12 | return; 13 | } 14 | 15 | for(i=1;i<=n;i++) 16 | { 17 | temp=0; 18 | for(j=1;j<=i;j++) 19 | temp+=j; 20 | sum+=temp; 21 | } 22 | printf("The sum of the sequence(%d) is %d\n",n,sum); 23 | getchar(); 24 | getchar(); 25 | } -------------------------------------------------------------------------------- /008.数列求和/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /009.乘法口诀表/9.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/009.乘法口诀表/9.c -------------------------------------------------------------------------------- /009.乘法口诀表/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /010.猜数字游戏/10.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void main() 4 | { 5 | int Password=0,Number=0,price=58,i=0; 6 | clrscr(); 7 | printf("\n====This is a Number Guess Game!====\n"); 8 | while( Password != 1234 ) 9 | { 10 | if( i >= 3 ) 11 | return; 12 | i++; 13 | puts("Please input Password: "); 14 | scanf("%d",&Password); 15 | } 16 | 17 | i=0; 18 | while( Number!=price ) 19 | { 20 | do{ 21 | puts("Please input a number between 1 and 100: "); 22 | scanf("%d",&Number); 23 | printf("Your input number is %d\n",Number); 24 | }while( !(Number>=1 && Number<=100) ); 25 | if( Number >= 90 ) 26 | { 27 | printf("Too Bigger! Press any key to try again!\n"); 28 | } 29 | else if( Number >= 70 && Number < 90 ) 30 | { 31 | printf("Bigger!\n"); 32 | } 33 | else if( Number >= 1 && Number <= 30 ) 34 | { 35 | printf("Too Small! Press any key to try again!\n"); 36 | } 37 | else if( Number > 30 && Number <= 50 ) 38 | { 39 | printf("Small! Press any key to try again!\n"); 40 | } 41 | else 42 | { 43 | if( Number == price ) 44 | { 45 | printf("OK! You are right! Bye Bye!\n"); 46 | } 47 | else if( Number < price ) 48 | { 49 | printf("Sorry,Only a little smaller! Press any key to try again!\n"); 50 | 51 | } 52 | else if( Number > price ) 53 | printf(" Sorry, Only a little bigger! Press any key to try again!\n"); 54 | } 55 | getch(); 56 | } 57 | } 58 | 59 |  -------------------------------------------------------------------------------- /010.猜数字游戏/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /011.模拟ATM(自动柜员机)界面/11.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int Password=0,Number=0,price=58,i=0; 6 | 7 | while( Password != 1234 ) 8 | { 9 | if( i >= 3 ) 10 | return; 11 | i++; 12 | puts("Please input Password: "); 13 | scanf("%d",&Password); 14 | } 15 | 16 | i=0; 17 | while( Number!=price ) 18 | { 19 | do{ 20 | puts("Please input a number between 1 and 100: "); 21 | scanf("%d",&Number); 22 | printf("Your input number is %d\n",Number); 23 | }while( !(Number>=1 && Number<=100) ); 24 | if( Number >= 90 ) 25 | { 26 | printf("Too Bigger! Press any key to try again!\n"); 27 | } 28 | else if( Number >= 70 && Number < 90 ) 29 | { 30 | printf("Bigger!\n"); 31 | } 32 | else if( Number >= 1 && Number <= 30 ) 33 | { 34 | printf("Too Small! Press any key to try again!\n"); 35 | } 36 | else if( Number > 30 && Number <= 50 ) 37 | { 38 | printf("Small! Press any key to try again!\n"); 39 | } 40 | else 41 | { 42 | if( Number == price ) 43 | { 44 | printf("OK! You are right! Bye Bye!\n"); 45 | } 46 | else if( Number < price ) 47 | { 48 | printf("Sorry,Only a little smaller! Press any key to try again!\n"); 49 | 50 | } 51 | else if( Number > price ) 52 | printf(" Sorry, Only a little bigger! Press any key to try again!\n"); 53 | } 54 | getch(); 55 | } 56 | } 57 | 58 |  -------------------------------------------------------------------------------- /011.模拟ATM(自动柜员机)界面/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /012.用一维数组统计学生成绩/12.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | char SelectKey,CreditMoney,DebitMoney; 5 | while(1) 6 | { 7 | do{ 8 | clrscr(); 9 | puts("========================="); 10 | puts("| Please select key: |"); 11 | puts("| 1. Quary |"); 12 | puts("| 2. Credit |"); 13 | puts("| 3. Debit |"); 14 | puts("| 4. Return |"); 15 | puts("========================="); 16 | SelectKey = getch(); 17 | }while( SelectKey!='1' && SelectKey!='2' && SelectKey!='3' && SelectKey!='4' ); 18 | switch(SelectKey) 19 | { 20 | case '1': 21 | clrscr(); 22 | puts("================================"); 23 | puts("| Your balance is $1000. |"); 24 | puts("| Press any key to return... |"); 25 | puts("================================"); 26 | getch(); 27 | break; 28 | case '2': 29 | do{ 30 | clrscr(); 31 | puts("=================================="); 32 | puts("| Please select Credit money: |"); 33 | puts("| 1. $50 |"); 34 | puts("| 2. $100 |"); 35 | puts("| 3. Return |"); 36 | puts("=================================="); 37 | CreditMoney = getch(); 38 | }while( CreditMoney!='1' && CreditMoney!='2' && CreditMoney!='3' ); 39 | switch(CreditMoney) 40 | { 41 | case '1': 42 | clrscr(); 43 | puts("========================================="); 44 | puts("| Your Credit money is $50,Thank you! |"); 45 | puts("| Press any key to return... |"); 46 | puts("========================================="); 47 | getch(); 48 | break; 49 | case '2': 50 | clrscr(); 51 | puts("=========================================="); 52 | puts("| Your Credit money is $100,Thank you! |"); 53 | puts("| Press any key to return... |"); 54 | puts("=========================================="); 55 | getch(); 56 | break; 57 | case '3': 58 | break; 59 | } 60 | break; 61 | case '3': 62 | do{ 63 | clrscr(); 64 | puts("===================================="); 65 | puts("| Please select Debit money: |"); 66 | puts("| 1. $50 |"); 67 | puts("| 2. $100 |"); 68 | puts("| 3. $500 |"); 69 | puts("| 4. $1000 |"); 70 | puts("| 5. Return |"); 71 | puts("===================================="); 72 | DebitMoney = getch(); 73 | }while( DebitMoney!='1' && DebitMoney!='2' && DebitMoney!='3' \ 74 | && DebitMoney!='4' && DebitMoney!='5' ); 75 | switch(DebitMoney) 76 | { 77 | case '1': 78 | clrscr(); 79 | puts("==========================================="); 80 | puts("| Your Debit money is $50,Thank you! |"); 81 | puts("| Press any key to return... |"); 82 | puts("==========================================="); 83 | getch(); 84 | break; 85 | case '2': 86 | clrscr(); 87 | puts("==========================================="); 88 | puts("| Your Debit money is $100,Thank you! |"); 89 | puts("| Press any key to return... |"); 90 | puts("==========================================="); 91 | getch(); 92 | break; 93 | case '3': 94 | clrscr(); 95 | puts("==========================================="); 96 | puts("| Your Debit money is $500,Thank you! |"); 97 | puts("| Press any key to return... |"); 98 | puts("==========================================="); 99 | getch(); 100 | break; 101 | case '4': 102 | clrscr(); 103 | puts("==========================================="); 104 | puts("| Your Debit money is $1000,Thank you! |"); 105 | puts("| Press any key to return... |"); 106 | puts("==========================================="); 107 | getch(); 108 | break; 109 | case '5': 110 | break; 111 | } 112 | break; 113 | case '4': 114 | clrscr(); 115 | puts("================================"); 116 | puts("| Thank you for your using! |"); 117 | puts("| Good bye! |"); 118 | puts("================================"); 119 | return; 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /012.用一维数组统计学生成绩/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /013.用二维数组实现矩阵转置/13.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/013.用二维数组实现矩阵转置/13.c -------------------------------------------------------------------------------- /013.用二维数组实现矩阵转置/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /014.求解二维数组的最大最小元素/14.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/014.求解二维数组的最大最小元素/14.C -------------------------------------------------------------------------------- /015.利用数组求前n个质数/15.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/015.利用数组求前n个质数/15.c -------------------------------------------------------------------------------- /015.利用数组求前n个质数/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /016.编制万年历/16.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/016.编制万年历/16.c -------------------------------------------------------------------------------- /017.对数组元素排序/17.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/017.对数组元素排序/17.c -------------------------------------------------------------------------------- /018.任意进制数的转换/18.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/018.任意进制数的转换/18.c -------------------------------------------------------------------------------- /019.判断回文数/19.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/019.判断回文数/19.c -------------------------------------------------------------------------------- /019.判断回文数/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /020.求数组前n元素之和/20.C: -------------------------------------------------------------------------------- 1 | int a[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; 2 | main() 3 | { 4 | int i; 5 | clrscr(); 6 | printf("\n The arry is:\n"); 7 | for(i=0;i 2 | #define MAX 50 3 | /* 函数rep实现对s中出现的s1中的字符替换为s2中相应的字符 */ 4 | rep(char *s,char *s1,char *s2) 5 | { 6 | char *p; 7 | 8 | for(;*s;s++)/*顺序访问字符串s中的每个字符*/ 9 | { 10 | for(p=s1;*p&&*p!=*s;p++);/*检查当前字符是否在字符串s1中出现*/ 11 | if(*p)*s=*(p-s1+s2);/*当前字符在字符串s1中出现,用字符串s2中的对应字符代替s中的字符*/ 12 | } 13 | } 14 | main( )/*示意程序*/ 15 | { 16 | char s[MAX];/*="ABCABC";*/ 17 | char s1[MAX],s2[MAX]; 18 | clrscr(); 19 | puts("Please input the string for s:"); 20 | scanf("%s",s); 21 | puts("Please input the string for s1:"); 22 | scanf("%s",s1); 23 | puts("Please input the string for s2:"); 24 | scanf("%s",s2); 25 | 26 | rep(s,s1,s2); 27 | puts("The string of s after displace is:"); 28 | printf("%s\n",s); 29 | puts("\n Press any key to quit..."); 30 | getch(); 31 | } 32 |  33 | -------------------------------------------------------------------------------- /028.从键盘读入实数/28.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/028.从键盘读入实数/28.c -------------------------------------------------------------------------------- /029.字符行排版/29.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/029.字符行排版/29.c -------------------------------------------------------------------------------- /030.字符排列/30.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/030.字符排列/30.c -------------------------------------------------------------------------------- /031.判断字符串是否回文/31.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define MAX 50 3 | int cycle(char *s) 4 | { 5 | char *h,*t; 6 | 7 | for(h=s,t=s+strlen(s)-1;t>h;h++,t--) 8 | if(*h!=*t) break; 9 | return t<=h; 10 | } 11 | 12 | main() 13 | { 14 | char s[MAX]; 15 | clrscr(); 16 | while(1) 17 | { 18 | puts("Please input the string you want to judge (input ^ to quit):"); 19 | scanf("%s",s); 20 | if(s[0]=='^') 21 | break; 22 | if(cycle(s)) 23 | printf(" %s is a cycle string.\n",s); 24 | else 25 | printf(" %s is not a cycle string.\n",s); 26 | } 27 | puts("\nThank you for your using,bye bye!\n"); 28 | } 29 |  -------------------------------------------------------------------------------- /032.通讯录的输入输出/32.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/032.通讯录的输入输出/32.c -------------------------------------------------------------------------------- /033.扑克牌的结构表示/33.c: -------------------------------------------------------------------------------- 1 | enum suits{CLUBS,DIAMONDS,HEARTS,SPADES}; 2 | struct card 3 | { 4 | enum suits suit; 5 | char value[3]; 6 | }; 7 | struct card deck[52]; 8 | char cardval[][3]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"}; 9 | char suitsname[][9]={"CLUBS","DIAMONDS","HEARTS","SPADES"}; 10 | 11 | main() 12 | { 13 | int i,j; 14 | enum suits s; 15 | clrscr(); 16 | for(i=0;i<=12;i++) 17 | for(s=CLUBS;s<=SPADES;s++) 18 | { 19 | j=i*4+s; 20 | deck[j].suit=s; 21 | strcpy(deck[j].value,cardval[i]); 22 | } 23 | for(j=0;j<52;j++) 24 | printf("(%s%3s)%c",suitsname[deck[j].suit],deck[j].value,j%4==3?'\n':'\t'); 25 | puts("\nPress any key to quit..."); 26 | getch(); 27 | } 28 |  -------------------------------------------------------------------------------- /034.用“结构”统计学生成绩/34.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/034.用“结构”统计学生成绩/34.c -------------------------------------------------------------------------------- /035.报数游戏/35.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/035.报数游戏/35.c -------------------------------------------------------------------------------- /036.模拟社会关系/36.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/036.模拟社会关系/36.c -------------------------------------------------------------------------------- /037.统计文件的字符数/37.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/037.统计文件的字符数/37.C -------------------------------------------------------------------------------- /038.同时显示两个文件的内容/38.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/038.同时显示两个文件的内容/38.C -------------------------------------------------------------------------------- /039.简单的文本编辑器/39.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/039.简单的文本编辑器/39.C -------------------------------------------------------------------------------- /040.文件的字数统计程序/40.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/040.文件的字数统计程序/40.c -------------------------------------------------------------------------------- /040.文件的字数统计程序/WORDCNT.DAT: -------------------------------------------------------------------------------- 1 | To be, or not to be, that is the question: 2 | Whether 'tis nobler in the mind to suffer 3 | The slings and arrows or outrageous fortune 4 | Or to take arms against a sea of troubles, 5 | And by opposing end them. To die -- to sleep -- 6 | No more; and by a sleep to say we end 7 | The heartache, and the thousand natural shocks 8 | That flesh is heir to. 'Tis a consummation 9 | Devoutly to be wished. To die -- to sleep. 10 | To sleep -- perchance to dream: ay, there's the rub! 11 | For in that sleep of death what dreams may come 12 | When we have shuffled off this mortal coil, 13 | Must give us pause. There's the respect 14 | That makes calamity of so long life. 15 | For who would bear the whips and scorns of time, 16 | The oppressor's wrong, the proud man's contumely, 17 | The pangs of despised love, the law's delay, 18 | The insolence of office, and the spurns 19 | That patient merit of the unworthy takes, 20 | When he himself might his quietus make 21 | With a bare bodkin? Who would these fardels bear, 22 | To grunt and sweat under a weary life, 23 | But that the dread of something after death -- 24 | The undiscovered country, from whose bourn 25 | No traveller returns -- puzzles the will, 26 | And makes us rather bear those ills we have 27 | Than fly to others that we know not of? 28 | Thus conscience does make cowards of us all, 29 | And thus the native hue of resolution 30 | Is sicklied o'er with the pale cast of thought, 31 | And enterprises of great pith and moment 32 | With this regard their currents turn awry 33 | And lose the name of action. 34 |  -------------------------------------------------------------------------------- /041.学生成绩管理程序/41.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/041.学生成绩管理程序/41.c -------------------------------------------------------------------------------- /041.学生成绩管理程序/STUDENT.DAT: -------------------------------------------------------------------------------- 1 | John 2 | 1041101 3 | 80 4 | 90 5 | 83 6 | Mike 7 | 1041102 8 | 85 9 | 94 10 | 88 11 | -------------------------------------------------------------------------------- /042.插入排序/42.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/042.插入排序/42.c -------------------------------------------------------------------------------- /043.希尔排序/43.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/043.希尔排序/43.c -------------------------------------------------------------------------------- /044.冒泡排序/44.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/044.冒泡排序/44.c -------------------------------------------------------------------------------- /045.快速排序/45.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/045.快速排序/45.c -------------------------------------------------------------------------------- /046.选择排序/46.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/046.选择排序/46.c -------------------------------------------------------------------------------- /047.堆排序/47.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/047.堆排序/47.c -------------------------------------------------------------------------------- /048.归并排序/48.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/048.归并排序/48.c -------------------------------------------------------------------------------- /049.基数排序/49.C: -------------------------------------------------------------------------------- 1 | #include "stdio.h" 2 | #include "conio.h" 3 | #include "stdlib.h" 4 | #define MAX 5 5 | typedef struct node 6 | { int k; 7 | struct node *next; 8 | } *lnode; 9 | lnode my_input(int *d) 10 | { lnode head,temp,terminal; 11 | char s[MAX+1]; 12 | printf("Input the records ('0' to end input):\n"); 13 | scanf("%s",s); 14 | head=NULL; 15 | *d=0; 16 | terminal=NULL; 17 | while(s[0]!='0') 18 | { 19 | temp=(lnode)malloc(sizeof(struct node)); 20 | if (strlen(s)>*d) 21 | *d=strlen(s); 22 | temp->k=atoi(s); 23 | if (head==NULL) 24 | { head=temp; 25 | terminal=temp; 26 | } 27 | else 28 | { 29 | terminal->next=temp; 30 | terminal=temp; 31 | } 32 | scanf("%s",s); 33 | } 34 | terminal->next=NULL; 35 | 36 | return head; 37 | } 38 | void my_output(lnode h) 39 | { 40 | lnode t=h; 41 | printf("\n"); 42 | while (h!=NULL) 43 | { 44 | printf("%d ",h->k); 45 | h=h->next; 46 | } 47 | h=t; 48 | /* getch(); */ 49 | } 50 | lnode Radix_Sort(lnode head,int d) 51 | { 52 | lnode p,q,h,t; 53 | int i,j,x,radix=1; 54 | h=(lnode)malloc(10*sizeof(struct node)); 55 | t=(lnode)malloc(10*sizeof(struct node)); 56 | for (i=d;i>=1;i--) 57 | { 58 | for (j=0;j<=9;j++) 59 | { h[j].next=NULL; 60 | t[j].next=NULL; 61 | } 62 | p=head; 63 | while (p!=NULL) 64 | { 65 | x=((p->k)/radix)%10; 66 | if (h[x].next==NULL) 67 | { 68 | h[x].next=p; 69 | t[x].next=p; 70 | } 71 | else 72 | { 73 | q=t[x].next; 74 | q->next=p; 75 | t[x].next=p; 76 | } 77 | p=p->next; 78 | } 79 | 80 | j=0; 81 | while (h[j].next==NULL) 82 | j++; 83 | head=h[j].next; 84 | q=t[j].next; 85 | for (x=j+1;x<=9;x++) 86 | if (h[x].next!=NULL) 87 | { 88 | q->next=h[x].next; 89 | q=t[x].next; 90 | } 91 | q->next=NULL; 92 | radix*=10; 93 | printf("\n---------------------\n"); 94 | } 95 | return head; 96 | } 97 | void my_free(lnode h) 98 | { 99 | lnode temp=h; 100 | while (temp) 101 | { 102 | h=temp->next; 103 | free(temp); 104 | temp=h; 105 | } 106 | } 107 | void main() 108 | { 109 | lnode h; 110 | int d; 111 | clrscr(); 112 | h=my_input(&d); 113 | puts("The sequence you input is:"); 114 | my_output(h); 115 | h=Radix_Sort(h,d); 116 | puts("\nThe sequence after radix_sort is:"); 117 | my_output(h); 118 | my_free(h); 119 | puts("\n Press any key to quit..."); 120 | getch(); 121 | } 122 | 123 |  124 | -------------------------------------------------------------------------------- /050.二叉搜索树操作/50.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/050.二叉搜索树操作/50.C -------------------------------------------------------------------------------- /051.二项式系数递归/51.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/051.二项式系数递归/51.C -------------------------------------------------------------------------------- /052.背包问题/52.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/052.背包问题/52.C -------------------------------------------------------------------------------- /053.顺序表插入和删除/53.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/053.顺序表插入和删除/53.c -------------------------------------------------------------------------------- /054.链表操作(1)/54.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define N 10 4 | 5 | typedef struct node 6 | { 7 | char name[20]; 8 | struct node *link; 9 | }stud; 10 | 11 | stud * creat() 12 | { 13 | stud *p,*h,*s; 14 | int i,n; 15 | puts("\nPlease input the number of linklist:"); 16 | scanf("%d",&n); 17 | if((h=(stud *)malloc(sizeof(stud)))==NULL) 18 | { 19 | printf("cannot find space!"); 20 | exit(0); 21 | } 22 | h->name[0]='\0'; 23 | h->link=NULL; 24 | p=h; 25 | for(i=0;ilink=s; 33 | printf("please input %d student's name: ",i+1); 34 | scanf("%s",s->name); 35 | s->link=NULL; 36 | p=s; 37 | } 38 | 39 | return(h); 40 | } 41 | 42 | stud * search(stud *h,char *x) 43 | { 44 | stud *p; 45 | char *y; 46 | p=h->link; 47 | while(p!=NULL) 48 | { 49 | y=p->name; 50 | if(strcmp(y,x)==0) 51 | return(p); 52 | else p=p->link; 53 | } 54 | if(p==NULL) 55 | printf("data not find!"); 56 | return 0; 57 | } 58 | 59 | stud * search2(stud *h,char *x) 60 | { 61 | stud *p,*s; 62 | char *y; 63 | p=h->link; 64 | s=h; 65 | while(p!=NULL) 66 | { 67 | y=p->name; 68 | if(strcmp(y,x)==0) 69 | return(s); 70 | else 71 | { 72 | p=p->link; 73 | s=s->link; 74 | } 75 | } 76 | if(p==NULL) 77 | printf("data not find!"); 78 | return 0; 79 | } 80 | 81 | void insert(stud *p) 82 | { 83 | char stuname[20]; 84 | stud *s; 85 | if((s= (stud *) malloc(sizeof(stud)))==NULL) 86 | { 87 | printf("cannot find space!"); 88 | exit(0); 89 | } 90 | printf("\nplease input the student's name: "); 91 | scanf("%s",stuname); 92 | strcpy(s->name,stuname); 93 | s->link=p->link; 94 | p->link=s; 95 | } 96 | 97 | void del(stud *x,stud *y) 98 | { 99 | stud *s; 100 | s=y; 101 | x->link=y->link; 102 | free(s); 103 | } 104 | 105 | void print(stud *h) 106 | { 107 | stud *p; 108 | p=h->link; 109 | printf("Now the link list is:\n"); 110 | while(p!=NULL) 111 | { 112 | printf("%s ",&*(p->name)); 113 | p=p->link; 114 | } 115 | printf("\n"); 116 | } 117 | 118 | void quit() 119 | { 120 | clrscr(); 121 | puts("\n Thank you for your using!\n Press any key to quit..."); 122 | getch(); 123 | exit(0); 124 | } 125 | 126 | void menu(void) 127 | { 128 | clrscr(); 129 | printf(" simple linklise realization of c\n"); 130 | printf(" ||=====================================||\n"); 131 | printf(" || ||\n"); 132 | printf(" || [1] create linklist ||\n"); 133 | printf(" || [2] seach ||\n"); 134 | printf(" || [3] insert ||\n"); 135 | printf(" || [4] delete ||\n"); 136 | printf(" || [5] print ||\n"); 137 | printf(" || [6] exit ||\n"); 138 | printf(" || ||\n"); 139 | printf(" || if no list exist,create first ||\n"); 140 | printf(" || ||\n"); 141 | printf(" ||=====================================||\n"); 142 | printf(" Please input your choose(1-6): "); 143 | } 144 | 145 | main() 146 | { 147 | int choose; 148 | stud *head,*searchpoint,*forepoint; 149 | char fullname[20]; 150 | 151 | 152 | while(1) 153 | { 154 | menu(); 155 | scanf("%d",&choose); 156 | switch(choose) 157 | { 158 | case 1: 159 | clrscr(); 160 | head=creat(); 161 | puts("Linklist created successfully! \nPress any key to return..."); 162 | getch(); 163 | break; 164 | case 2: 165 | clrscr(); 166 | printf("Input the student's name which you want to find:\n"); 167 | scanf("%s",fullname); 168 | searchpoint=search(head,fullname); 169 | printf("The stud name you want to find is:%s",*&searchpoint->name); 170 | printf("\nPress any key to returen..."); 171 | getchar(); 172 | getchar(); 173 | break; 174 | case 3: 175 | clrscr(); 176 | insert(head); 177 | print(head); 178 | printf("\nPress any key to returen..."); 179 | getchar();getchar(); 180 | break; 181 | case 4: 182 | clrscr(); 183 | print(head); 184 | printf("\nInput the student's name which you want to delete:\n"); 185 | scanf("%s",fullname); 186 | searchpoint=search(head,fullname); 187 | forepoint=search2(head,fullname); 188 | del(forepoint,searchpoint); 189 | print(head); 190 | puts("\nDelete successfully! Press any key to return..."); 191 | getchar(); 192 | getchar(); 193 | break; 194 | case 5:print(head); 195 | printf("\nPress any key to return..."); 196 | getchar();getchar(); 197 | break; 198 | case 6:quit(); 199 | break; 200 | default: 201 | clrscr(); 202 | printf("Illegal letter! Press any key to return..."); 203 | menu(); 204 | getchar(); 205 | } 206 | } 207 | } 208 | 209 |  -------------------------------------------------------------------------------- /055.链表操作(2)/55.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/055.链表操作(2)/55.c -------------------------------------------------------------------------------- /056.单链表就地逆置/56.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/056.单链表就地逆置/56.c -------------------------------------------------------------------------------- /057.运动会分数统计/57.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/057.运动会分数统计/57.c -------------------------------------------------------------------------------- /058.双链表/58.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/058.双链表/58.c -------------------------------------------------------------------------------- /059.约瑟夫环/59.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/059.约瑟夫环/59.c -------------------------------------------------------------------------------- /060.记录个人资料/60.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | struct Family *get_person(void); /* Prototype for input function */ 7 | char related(struct Family *pmember1, struct Family *pmember2); 8 | char set_ancestry(struct Family *pmember1, struct Family *pmember2); 9 | 10 | struct Date 11 | { 12 | int day; 13 | int month; 14 | int year; 15 | }; 16 | 17 | struct Family /* Family structure declaration */ 18 | { 19 | struct Date dob; 20 | char name[20]; 21 | char father[20]; 22 | char mother[20]; 23 | struct Family *next; /* Pointer to next structure */ 24 | struct Family *previous; /* Pointer to previous structure */ 25 | struct Family *p_to_pa; /* Pointer to father structure */ 26 | struct Family *p_to_ma; /* Pointer to mother structure */ 27 | }; 28 | 29 | void main() 30 | { 31 | struct Family *first = NULL; /* Pointer to first person */ 32 | struct Family *current = NULL; /* Pointer to current person */ 33 | struct Family *last = NULL; /* Pointer to previous person */ 34 | 35 | char more = '\0'; /* Test value for ending input */ 36 | 37 | for( ; ; ) 38 | { 39 | printf("\nDo you want to enter details of a%s person (Y or N)? ", 40 | first != NULL?"nother " : "" ); 41 | scanf(" %c", &more); 42 | if(tolower(more) == 'n') 43 | break; 44 | 45 | current = get_person(); 46 | 47 | if(first == NULL) 48 | { 49 | first = current; /* Set pointer to first Family */ 50 | last = current; /* Remember for next iteration */ 51 | } 52 | else 53 | { 54 | last->next = current; /* Set next address for previous Family */ 55 | current->previous = last; /* Set previous address for current */ 56 | last = current; /* Remember for next iteration */ 57 | } 58 | } 59 | 60 | current = first; 61 | 62 | while(current->next != NULL) /* Check for relation for each person in */ 63 | { /* the list up to second to last */ 64 | int parents = 0; /* Declare parent count local to this block */ 65 | last = current->next; /* Get the pointer to the next */ 66 | 67 | while(last != NULL) /* This loop tests current person */ 68 | { /* against all the remainder in the list */ 69 | if(related(current, last)) /* Found a parent ? */ 70 | if(++parents == 2) /* Yes, update count and check it */ 71 | break; /* Exit inner loop if both parents found */ 72 | 73 | last = last->next; /* Get the address of the next */ 74 | } 75 | current = current->next; /* Next in the list to check */ 76 | } 77 | 78 | /* Now tell them what we know */ 79 | 80 | /* Output Family data in correct order */ 81 | current = first; 82 | 83 | while (current != NULL) /* Output Family data in correct order */ 84 | { 85 | printf("\n%s was born %d/%d/%d, and has %s and %s as parents.", 86 | current->name, current->dob.day, current->dob.month, 87 | current->dob. year, current->father, current->mother); 88 | if(current->p_to_pa != NULL ) 89 | printf("\n\t%s's birth date is %d/%d/%d ", 90 | current->father, current->p_to_pa->dob.day, 91 | current->p_to_pa->dob.month, 92 | current->p_to_pa->dob.year); 93 | if(current->p_to_ma != NULL) 94 | printf("and %s's birth date is %d/%d/%d.\n ", 95 | current->mother, current->p_to_ma->dob.day, 96 | current->p_to_ma->dob.month, 97 | current->p_to_ma->dob.year); 98 | 99 | current = current->next; /* current points to next in list */ 100 | } 101 | 102 | /* Now free the memory */ 103 | current = first; 104 | while(current->next != NULL) 105 | { 106 | last = current; /* Save pointer to enable memory to be freed */ 107 | current = current->next; /* current points to next in list */ 108 | free(last); /* Free memory for last */ 109 | } 110 | } 111 | 112 | /* Function to input data on Family members */ 113 | struct Family *get_person(void) 114 | { 115 | struct Family *temp; /* Define temporary structure pointer */ 116 | 117 | /* Allocate memory for a structure */ 118 | temp = (struct Family*) malloc(sizeof(struct Family)); 119 | printf("\nEnter the name of the person: "); 120 | scanf("%s", temp -> name ); /* Read the Family's name */ 121 | printf("\nEnter %s's date of birth (day month year); ", temp->name); 122 | scanf("%d %d %d", &temp->dob.day, &temp->dob.month, &temp->dob.year); 123 | printf("\nWho is %s's father? ", temp->name ); 124 | scanf("%s", temp->father ); /* Get the father's name */ 125 | printf("\nWho is %s's mother? ", temp -> name ); 126 | scanf("%s", temp -> mother ); /* Get the mother's name */ 127 | temp->next = temp->previous = NULL; /* Set pointers to NULL */ 128 | temp->p_to_pa = temp->p_to_ma = NULL; /* Set pointers to NULL */ 129 | return temp; /* Return address of Family structure */ 130 | } 131 | 132 | char set_ancestry(struct Family *pmember1, struct Family *pmember2) 133 | { 134 | if(strcmp(pmember1->father, pmember2->name) == 0) 135 | { 136 | pmember1->p_to_pa = pmember2; 137 | return 1; 138 | } 139 | if( strcmp(pmember1->mother, pmember2->name) == 0) 140 | { 141 | pmember1->p_to_ma = pmember2; 142 | return 1; 143 | } 144 | else 145 | return 0; 146 | } 147 | /* Fill in pointers for mother or father relationships */ 148 | char related (struct Family *pmember1, struct Family *pmember2) 149 | { 150 | return set_ancestry(pmember1, pmember2) || 151 | set_ancestry(pmember2, pmember1); 152 | } 153 | -------------------------------------------------------------------------------- /061.二叉树遍利/61.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef struct bitnode 4 | { 5 | char data; 6 | struct bitnode *lchild, *rchild; 7 | }bitnode, *bitree; 8 | 9 | void createbitree(t,n) 10 | bitnode ** t; 11 | int *n; 12 | { 13 | char x; 14 | bitnode *q; 15 | 16 | *n=*n+1; 17 | printf(" Input %d DATA: ",*n); 18 | x=getchar(); 19 | if(x!='\n') getchar(); 20 | 21 | if (x=='^') 22 | return; 23 | 24 | q=(bitnode*)malloc(sizeof(bitnode)); 25 | q->data=x; 26 | q->lchild=NULL; 27 | q->rchild=NULL; 28 | *t=q; 29 | 30 | printf("This Address is:%o,Data is:%c, Left Pointer is:%o,Right Pointer is: %o\n",q,q->data,q->lchild,q->rchild); 31 | 32 | createbitree(&q->lchild,n); 33 | createbitree(&q->rchild,n); 34 | return; 35 | } 36 | 37 | void visit(e) 38 | bitnode *e; 39 | { 40 | printf(" Address: %o, Data: %c, Left Pointer: %o, Right Pointer: %o\n",e,e->data,e->lchild,e->rchild); 41 | } 42 | 43 | void preordertraverse(t) 44 | bitnode *t; 45 | { 46 | if(t) 47 | { 48 | visit(t); 49 | preordertraverse(t->lchild); 50 | preordertraverse(t->rchild); 51 | return ; 52 | }else return ; 53 | } 54 | 55 | void countleaf(t,c) 56 | bitnode *t; 57 | int *c; 58 | { 59 | if(t!=NULL) 60 | { 61 | if (t->lchild==NULL && t->rchild==NULL) 62 | { 63 | *c=*c+1; 64 | } 65 | countleaf(t->lchild,c); 66 | countleaf(t->rchild,c); 67 | } 68 | return; 69 | } 70 | 71 | int treehigh(t) 72 | bitnode *t; 73 | { 74 | int lh,rh,h; 75 | if(t==NULL) 76 | h=0; 77 | else 78 | { 79 | lh=treehigh(t->lchild); 80 | rh=treehigh(t->rchild); 81 | h=(lh>rh ? lh:rh)+1; 82 | } 83 | 84 | return h; 85 | } 86 | main() 87 | { 88 | bitnode *t; int count=0; 89 | int n=0; 90 | clrscr(); 91 | printf("Please initialize the TREE!\n"); 92 | createbitree(&t,&n); 93 | 94 | printf("\n This is TREE Struct:\n"); 95 | preordertraverse(t); 96 | 97 | countleaf(t,&count); 98 | printf(" This TREE has %d leaves.",count); 99 | 100 | printf("\n High of The TREE is: %d\n",treehigh(t)); 101 | puts("\n Press any key to quit..."); 102 | getch(); 103 | } 104 | 105 |  -------------------------------------------------------------------------------- /062.浮点数转换为字符串/62.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/062.浮点数转换为字符串/62.c -------------------------------------------------------------------------------- /063.汉诺塔问题/63.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/063.汉诺塔问题/63.c -------------------------------------------------------------------------------- /064.哈夫曼编码/64.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/064.哈夫曼编码/64.c -------------------------------------------------------------------------------- /065.图的深度优先遍利/65.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/065.图的深度优先遍利/65.C -------------------------------------------------------------------------------- /066.图的广度优先遍利/66.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/066.图的广度优先遍利/66.C -------------------------------------------------------------------------------- /067.求解最优交通路径/67.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/067.求解最优交通路径/67.c -------------------------------------------------------------------------------- /068.八皇后问题/68.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/068.八皇后问题/68.c -------------------------------------------------------------------------------- /069.骑士巡游/69.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/069.骑士巡游/69.c -------------------------------------------------------------------------------- /070.用栈设置密码/70.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/070.用栈设置密码/70.c -------------------------------------------------------------------------------- /071.魔王语言翻译/71.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/071.魔王语言翻译/71.c -------------------------------------------------------------------------------- /072.火车车厢重排/72.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/072.火车车厢重排/72.c -------------------------------------------------------------------------------- /073.队列实例/73.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define MAX 100 7 | 8 | char *p[MAX], *qretrieve(void); 9 | int spos = 0; 10 | int rpos = 0; 11 | void enter(void), qstore(char *q), review(void), delete_ap(void); 12 | 13 | int main(void) 14 | { 15 | char s[80]; 16 | register int t; 17 | 18 | for(t=0; t < MAX; ++t) p[t] = NULL; /* init array to nulls */ 19 | 20 | for(;;) { 21 | printf("Enter, List, Remove, Quit: "); 22 | gets(s); 23 | *s = toupper(*s); 24 | 25 | switch(*s) { 26 | case 'E': 27 | enter(); 28 | break; 29 | case 'L': 30 | review(); 31 | break; 32 | case 'R': 33 | delete_ap(); 34 | break; 35 | case 'Q': 36 | exit(0); 37 | } 38 | } 39 | return 0; 40 | } 41 | /* Enter appointments in queue. */ 42 | void enter(void) 43 | { 44 | char s[256], *p; 45 | 46 | do { 47 | printf("Enter appointment %d: ", spos+1); 48 | gets(s); 49 | if(*s==0) break; /* no entry */ 50 | p = (char *) malloc(strlen(s)+1); 51 | if(!p) { 52 | printf("Out of memory.\n"); 53 | return; 54 | } 55 | strcpy(p, s); 56 | if(*s) qstore(p); 57 | } while(*s); 58 | } 59 | 60 | /* See what's in the queue. */ 61 | void review(void) 62 | { 63 | register int t; 64 | 65 | for(t=rpos; t < spos; ++t) 66 | printf("%d. %s\n", t+1, p[t]); 67 | } 68 | 69 | /* Delete an appointment from the queue. */ 70 | void delete_ap(void) 71 | { 72 | char *p; 73 | 74 | if((p=qretrieve())==NULL) return; 75 | printf("%s\n", p); 76 | } 77 | 78 | /* Store an appointment. */ 79 | void qstore(char *q) 80 | { 81 | if(spos==MAX) { 82 | printf("List Full\n"); 83 | return; 84 | } 85 | p[spos] = q; 86 | spos++; 87 | } 88 | 89 | /* Retrieve an appointment. */ 90 | char *qretrieve(void) 91 | { 92 | if(rpos==spos) { 93 | printf("No more appointments.\n"); 94 | return NULL; 95 | } 96 | rpos++; 97 | return p[rpos-1]; 98 | } 99 | -------------------------------------------------------------------------------- /074.K阶斐波那契序列/74.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/074.K阶斐波那契序列/74.c -------------------------------------------------------------------------------- /075.绘制余弦曲线和直线的迭加/75.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/075.绘制余弦曲线和直线的迭加/75.c -------------------------------------------------------------------------------- /076.计算高次方数的尾数/76.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/076.计算高次方数的尾数/76.c -------------------------------------------------------------------------------- /077.打鱼还是晒网/77.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/077.打鱼还是晒网/77.c -------------------------------------------------------------------------------- /078.怎样存钱以获取最大利息/78.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/078.怎样存钱以获取最大利息/78.c -------------------------------------------------------------------------------- /079.阿姆斯特朗数/79.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/079.阿姆斯特朗数/79.c -------------------------------------------------------------------------------- /080.亲密数/80.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/080.亲密数/80.c -------------------------------------------------------------------------------- /081.自守数/81.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/081.自守数/81.c -------------------------------------------------------------------------------- /082.具有abcd=(ab+cd)2性质的数/82.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/082.具有abcd=(ab+cd)2性质的数/82.c -------------------------------------------------------------------------------- /083.验证歌德巴赫猜想/83.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/083.验证歌德巴赫猜想/83.c -------------------------------------------------------------------------------- /084.素数幻方/84.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/084.素数幻方/84.c -------------------------------------------------------------------------------- /085.百钱百鸡问题/85.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/085.百钱百鸡问题/85.c -------------------------------------------------------------------------------- /086.爱因斯坦的数学题/86.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/086.爱因斯坦的数学题/86.c -------------------------------------------------------------------------------- /087.三色球问题/87.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/087.三色球问题/87.c -------------------------------------------------------------------------------- /088.马克思手稿中的数学题/88.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/088.马克思手稿中的数学题/88.c -------------------------------------------------------------------------------- /089.配对新郎和新娘/89.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/089.配对新郎和新娘/89.c -------------------------------------------------------------------------------- /090.约瑟夫问题/90.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/090.约瑟夫问题/90.c -------------------------------------------------------------------------------- /091.邮票组合/91.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/091.邮票组合/91.C -------------------------------------------------------------------------------- /092.分糖果/92.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/092.分糖果/92.c -------------------------------------------------------------------------------- /093.波瓦松的分酒趣题/93.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/093.波瓦松的分酒趣题/93.C -------------------------------------------------------------------------------- /094.求π的近似值/94.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/094.求π的近似值/94.c -------------------------------------------------------------------------------- /095.奇数平方的有趣性质/95.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/095.奇数平方的有趣性质/95.c -------------------------------------------------------------------------------- /096.角谷猜想/96.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/096.角谷猜想/96.C -------------------------------------------------------------------------------- /097.四方定理/97.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/097.四方定理/97.C -------------------------------------------------------------------------------- /098.卡布列克常数/98.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/098.卡布列克常数/98.C -------------------------------------------------------------------------------- /099.尼科彻斯定理/99.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/099.尼科彻斯定理/99.C -------------------------------------------------------------------------------- /100.扑克牌自动发牌/100.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/100.扑克牌自动发牌/100.C -------------------------------------------------------------------------------- /101.常胜将军/101.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/101.常胜将军/101.C -------------------------------------------------------------------------------- /102.搬山游戏/102.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/102.搬山游戏/102.C -------------------------------------------------------------------------------- /103.兔子产子(菲波那契数列)/103.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/103.兔子产子(菲波那契数列)/103.c -------------------------------------------------------------------------------- /104.数字移动/104.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/104.数字移动/104.C -------------------------------------------------------------------------------- /105.多项式乘法/105.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/105.多项式乘法/105.c -------------------------------------------------------------------------------- /106.产生随机数/106.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/106.产生随机数/106.c -------------------------------------------------------------------------------- /107.堆栈四则运算/107.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/107.堆栈四则运算/107.c -------------------------------------------------------------------------------- /108.递归整数四则运算/108.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/108.递归整数四则运算/108.c -------------------------------------------------------------------------------- /109.复平面作图/109.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/109.复平面作图/109.c -------------------------------------------------------------------------------- /110.绘制彩色抛物线/110.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/110.绘制彩色抛物线/110.c -------------------------------------------------------------------------------- /111.绘制正态分布曲线/111.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/111.绘制正态分布曲线/111.c -------------------------------------------------------------------------------- /112.求解非线性方程/112.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/112.求解非线性方程/112.c -------------------------------------------------------------------------------- /113.实矩阵乘法运算/113.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/113.实矩阵乘法运算/113.c -------------------------------------------------------------------------------- /114.求解线性方程/114.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/114.求解线性方程/114.c -------------------------------------------------------------------------------- /115.n阶方阵求逆/115.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/115.n阶方阵求逆/115.C -------------------------------------------------------------------------------- /116.复矩阵乘法/116.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/116.复矩阵乘法/116.C -------------------------------------------------------------------------------- /117.求定积分/117.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/117.求定积分/117.C -------------------------------------------------------------------------------- /118.求满足特异条件的数列/118.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/118.求满足特异条件的数列/118.C -------------------------------------------------------------------------------- /119.超长正整数的加法/119.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/119.超长正整数的加法/119.C -------------------------------------------------------------------------------- /120.绘制直线/120.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int gdriver=DETECT,gmode; 5 | initgraph(&gdriver,&gmode,"c:\\tc"); 6 | cleardevice(); 7 | line(160,120,480,120); 8 | line(480,120,480,360); 9 | line(480,360,160,360); 10 | line(160,360,160,120); 11 | getch(); 12 | closegraph(); 13 | } -------------------------------------------------------------------------------- /121.绘制圆/121.C: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int gdriver=DETECT,gmode; 5 | initgraph(&gdriver,&gmode,"c:\\tc"); 6 | cleardevice(); 7 | moveto(160,120); 8 | lineto(480,120); 9 | lineto(480,360); 10 | lineto(160,360); 11 | lineto(160,120); 12 | getch(); 13 | closegraph(); 14 | } -------------------------------------------------------------------------------- /122.绘制圆弧/122.C: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int gdriver=DETECT,gmode; 5 | initgraph(&gdriver,&gmode,"c:\\tc"); 6 | cleardevice(); 7 | moveto(160,120); 8 | linerel(320,0); 9 | linerel(0,240); 10 | linerel(-320,0); 11 | linerel(0,-240); 12 | getch(); 13 | closegraph(); 14 | } -------------------------------------------------------------------------------- /123.绘制椭圆/123.C: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int gdriver=DETECT,gmode; 5 | initgraph(&gdriver,&gmode,"c:\\tc"); 6 | cleardevice(); 7 | moveto(160,120); 8 | linerel(320,0); 9 | linerel(0,240); 10 | linerel(-320,0); 11 | linerel(0,-240); 12 | getch(); 13 | closegraph(); 14 | } -------------------------------------------------------------------------------- /124.设置背景色和前景色/124.C: -------------------------------------------------------------------------------- 1 | /* set color */ 2 | #include 3 | void main() 4 | { 5 | int cb,cf; 6 | int gdriver=DETECT,gmode; 7 | initgraph(&gdriver,&gmode,"c:\\tc"); 8 | cleardevice(); 9 | for(cb=0;cb<=15;cb++) 10 | { 11 | setbkcolor(cb); 12 | for(cf=0;cf<=15;cf++) 13 | { 14 | setcolor(cf); 15 | circle(100+cf*25,240,100); 16 | 17 | } 18 | getch(); 19 | } 20 | getch(); 21 | closegraph(); 22 | } -------------------------------------------------------------------------------- /125.设置线条类型/125.C: -------------------------------------------------------------------------------- 1 | /* set line style */ 2 | #include 3 | void main() 4 | { 5 | int i,j,c,x=50,y=50,k=1; 6 | int gdriver=DETECT,gmode; 7 | 8 | initgraph(&gdriver,&gmode,"c:\\tc"); 9 | cleardevice(); 10 | setbkcolor(9); 11 | setcolor(4); 12 | for(j=1;j<=2;j++) 13 | { 14 | for(i=0;i<4;i++) 15 | { 16 | setlinestyle(i,0,k); 17 | line(50,50+i*50+(j-1)*200,200,200+i*50+(j-1)*200); 18 | rectangle(x,y,x+210,y+80); 19 | circle(100+i*50+(j-1)*200,240,100); 20 | } 21 | k=3; 22 | x=50; 23 | y=250; 24 | } 25 | getch(); 26 | closegraph(); 27 | } -------------------------------------------------------------------------------- /126.设置填充类型和填充颜色/126.C: -------------------------------------------------------------------------------- 1 | /* set fill style */ 2 | #include 3 | void main() 4 | { 5 | int i,c=4,x=5,y=6; 6 | int gdriver=DETECT,gmode; 7 | 8 | initgraph(&gdriver,&gmode,"c:\\tc"); 9 | cleardevice(); 10 | setcolor(c); 11 | for(i=c;i 3 | void main() 4 | { 5 | int x; 6 | int gdriver=DETECT,gmode; 7 | 8 | initgraph(&gdriver,&gmode,"c:\\tc"); 9 | cleardevice(); 10 | setcolor(4); 11 | for(x=160;x<=480;x+=20) 12 | { 13 | line(160,240,x,120); 14 | line(160,240,x,360); 15 | line(480,240,640-x,360); 16 | line(480,240,640-x,120); 17 | } 18 | outtextxy(80,400,"Press any key to quit..."); 19 | getch(); 20 | closegraph(); 21 | } -------------------------------------------------------------------------------- /128.金刚石图案/128.C: -------------------------------------------------------------------------------- 1 | /* diamond */ 2 | #include 3 | #include 4 | void main() 5 | { 6 | float t; 7 | int x0=320,y0=240; 8 | int n,i,j,r; 9 | int x[50],y[50]; 10 | int gdriver=DETECT,gmode; 11 | printf("Please input n(23<=n<=31) and r(100<=r<=200):\n"); 12 | scanf("%d%d",&n,&r); 13 | 14 | initgraph(&gdriver,&gmode,"c:\\tc"); 15 | cleardevice(); 16 | setcolor(4); 17 | outtextxy(80,20,"This program show the Diamond picture."); 18 | t=6.28318/n; 19 | 20 | for(i=0;i 3 | #include 4 | #define PI 3.1415926 5 | void main() 6 | { 7 | double a; 8 | int x1,y1,x2,px=320,py=240; 9 | int gdriver=DETECT,gmode; 10 | initgraph(&gdriver,&gmode,"c:\\tc"); 11 | cleardevice(); 12 | setcolor(4); 13 | outtextxy(80,20,"This program show the Linesin picture."); 14 | 15 | for(a=0;a<=PI;a+=PI/380) 16 | { 17 | x1=px+280*cos(1.6*a); 18 | y1=479-((90*sin(8*a))*cos(a/2.5)+py); 19 | x2=py+280*cos(1.8*a); 20 | line(x1,y1,x2,y1); 21 | } 22 | outtextxy(80,460,"Press any key to quit..."); 23 | getch(); 24 | closegraph(); 25 | } -------------------------------------------------------------------------------- /130.圆环图案/130.C: -------------------------------------------------------------------------------- 1 | /* circles */ 2 | #include 3 | #include 4 | #define PI 3.1415926 5 | void main() 6 | { 7 | double a; 8 | int x,y,r1,rs; 9 | int gdriver=DETECT,gmode; 10 | printf("Please input R1(<100) and Rs:\n"); 11 | scanf("%d%d",&r1,&rs); 12 | 13 | initgraph(&gdriver,&gmode,"c:\\tc"); 14 | cleardevice(); 15 | setcolor(4); 16 | outtextxy(80,20,"This program show the Circles picture."); 17 | 18 | for(a=0;a<=2*PI;a+=PI/18) 19 | { 20 | x=320+r1*cos(a); 21 | y=240+r1*sin(a); 22 | circle(x,y,rs); 23 | } 24 | outtextxy(80,460,"Press any key to quit..."); 25 | getch(); 26 | closegraph(); 27 | } -------------------------------------------------------------------------------- /131.肾形图案/131.C: -------------------------------------------------------------------------------- 1 | /* Kidney */ 2 | #include 3 | #include 4 | #define PI 3.1415926 5 | void main() 6 | { 7 | double a; 8 | int x,y,r,r1; 9 | int gdriver=9,gmode=2; 10 | initgraph(&gdriver,&gmode,"c:\\tc"); 11 | printf("Please input Radus(<150): "); 12 | scanf("%d",&r); 13 | cleardevice(); 14 | setbkcolor(MAGENTA); 15 | setcolor(WHITE); 16 | outtextxy(80,20,"This program show the Kidney picture."); 17 | 18 | for(a=0;a<=2*PI;a+=PI/27) 19 | { 20 | x=320+r*cos(a); 21 | y=240+r*sin(a); 22 | r1=abs(x-320); 23 | circle(x,y,r1); 24 | } 25 | outtextxy(80,460,"Press any key to quit..."); 26 | getch(); 27 | closegraph(); 28 | } -------------------------------------------------------------------------------- /132.心脏形图案/132.C: -------------------------------------------------------------------------------- 1 | /* Heart */ 2 | #include 3 | #include 4 | #define PI 3.1415926 5 | void main() 6 | { 7 | double a; 8 | int x,y,y1,r,r1; 9 | int gdriver=DETECT,gmode; 10 | initgraph(&gdriver,&gmode,"c:\\tc"); 11 | printf("Please input Radus(<80): "); 12 | scanf("%d",&r); 13 | cleardevice(); 14 | setbkcolor(9); 15 | setcolor(4); 16 | outtextxy(80,20,"This program show the Kidney picture."); 17 | 18 | y1=240-r; 19 | for(a=0;a<=2*PI;a+=PI/27) 20 | { 21 | x=320+r*cos(a); 22 | y=240+r*sin(a); 23 | r1=sqrt((x-320)*(x-320)+(y-y1)*(y-y1)); 24 | circle(x,y,r1); 25 | } 26 | outtextxy(80,460,"Press any key to quit..."); 27 | getch(); 28 | closegraph(); 29 | } -------------------------------------------------------------------------------- /133.渔网图案/133.C: -------------------------------------------------------------------------------- 1 | /* Fishing Net */ 2 | #include 3 | void main() 4 | { 5 | int x,y,x1,y1,x0=320,y0=50; 6 | int i,j,n=5,r=20; 7 | int gdriver=VGA,gmode=VGAHI; 8 | initgraph(&gdriver,&gmode,"c:\\tc"); 9 | cleardevice(); 10 | setbkcolor(9); 11 | outtextxy(80,20,"This program show the Fishing Net picture."); 12 | 13 | for(i=0;i<=2*n;i++) 14 | { 15 | x1=x0-i*r; 16 | y1=y0+i*r; 17 | for(j=0;j<=n-1;j++) 18 | { 19 | x=x1+2*j*r; 20 | y=y1+2*j*r; 21 | arc(x,y,180,270,r); 22 | arc(x,y+2*r,0,90,r); 23 | } 24 | } 25 | x1=x0-2*r; 26 | y1=y0; 27 | for(i=0;i<=2*n;i++) 28 | { 29 | x1=x1+r; 30 | y1=y1+r; 31 | for(j=0;j<=n-1;j++) 32 | { 33 | x=x1-2*j*r; 34 | y=y1+2*j*r; 35 | arc(x,y,90,180,r); 36 | arc(x-2*r,y,270,360,r); 37 | } 38 | } 39 | 40 | outtextxy(80,460,"Press any key to quit..."); 41 | getch(); 42 | closegraph(); 43 | } -------------------------------------------------------------------------------- /134.沙丘图案/134.C: -------------------------------------------------------------------------------- 1 | /* Sandhill */ 2 | #include 3 | #include 4 | #define PI 3.1415926 5 | void main() 6 | { 7 | double a,b,c; 8 | int x,y,py; 9 | int gdriver=DETECT,gmode; 10 | initgraph(&gdriver,&gmode,"c:\\tc"); 11 | cleardevice(); 12 | setbkcolor(9); 13 | setcolor(14); 14 | outtextxy(80,3,"This program show the Sandhill picture."); 15 | 16 | for(py=20;py<=380;py+=3) 17 | { 18 | c=(py-20)*4*PI/360; 19 | b=PI*cos(c); 20 | for(a=0;a<=6*PI;a+=PI/7) 21 | { 22 | x=600/(6*PI)*a+20; 23 | y=10*sin(a+cos(a)*PI-b)*cos(c)+py; 24 | if(a==0) 25 | moveto(x,y); 26 | else 27 | lineto(x,y); 28 | } 29 | } 30 | outtextxy(80,460,"Press any key to quit..."); 31 | getch(); 32 | closegraph(); 33 | } -------------------------------------------------------------------------------- /135.设置图形方式下的文本类型/135.C: -------------------------------------------------------------------------------- 1 | /* text */ 2 | #include 3 | #include 4 | void main() 5 | { 6 | int i,t,x=300,y=50; 7 | int gdriver=DETECT,gmode; 8 | initgraph(&gdriver,&gmode,"c:\\tc"); 9 | setbkcolor(9); 10 | setcolor(4); 11 | printf("Please input delay time (1-10): "); 12 | scanf("%d",&t); 13 | outtextxy(80,20,"This program show the Text in graphic mode."); 14 | 15 | for(i=1;i<=10;i++) 16 | { 17 | x=x-15; 18 | y=y+15; 19 | settextstyle(1,0,i); 20 | /*cleardevice();*/ 21 | outtextxy(x,y,"Hello!"); 22 | delay(1000*t); 23 | } 24 | settextstyle(1,0,1); 25 | outtextxy(80,420,"Press any key to quit..."); 26 | getch(); 27 | closegraph(); 28 | } -------------------------------------------------------------------------------- /136.绘制正多边形/136.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void polygon(x0,y0,a,n,af) 5 | int x0,y0,a,n; 6 | float af; 7 | { 8 | int x,y,i; 9 | float dtheta,theta; 10 | if(n<3) 11 | return; 12 | dtheta=6.28318/n; 13 | theta=af*0.0174533; 14 | moveto(x0,y0); 15 | x=x0; 16 | y=y0; 17 | for(i=0;i 2 | #include 3 | void polygonc(); 4 | void main() 5 | { 6 | int i,r,n,x=320,y=240; 7 | int gdriver=9,gmode=2; 8 | float theta,alfa; 9 | n=30; 10 | theta=6.0; 11 | initgraph(&gdriver,&gmode,"c:\\tc"); 12 | cleardevice(); 13 | setbkcolor(MAGENTA); 14 | setcolor(WHITE); 15 | r=160; 16 | alfa=60.0; 17 | for(i=0;i 2 | #include 3 | void polygonc(); 4 | void block(); 5 | 6 | void main() 7 | { 8 | int i,j,a,length,n,theta,x=100,y=350; 9 | int gdriver=DETECT,gmode; 10 | printf("input length, n theta:"); 11 | scanf("%d%d%d",&length,&n,&theta); 12 | initgraph(&gdriver,&gmode,"c:\\tc"); 13 | cleardevice(); 14 | setbkcolor(9); 15 | setcolor(4); 16 | a=length/4; 17 | for(i=1;i<=4;i++) 18 | { 19 | for(j=1;j<=4;j++) 20 | { 21 | block(x,y,a,n,theta); 22 | theta=-theta; 23 | x=x+a; 24 | } 25 | x=100; 26 | y=y-a; 27 | theta=-theta; 28 | } 29 | getch(); 30 | closegraph(); 31 | } 32 | void polygonc(x0,y0,r,n,af) 33 | int x0,y0,n,r; 34 | float af; 35 | { 36 | int x,y,xs,ys,i; 37 | float dtheta,theta; 38 | if(n<3) 39 | return; 40 | dtheta=6.28318/n; 41 | theta=af*0.0174533; 42 | xs=x0+r*cos(theta); 43 | ys=y0+r*sin(theta); 44 | moveto(xs,ys); 45 | for(i=1;i 2 | #include 3 | void tria(xa,ya,xb,yb,xc,yc,n) 4 | int xa,ya,xb,yb,xc,yc,n; 5 | { 6 | int xp,yp,xq,yq,xr,yr; 7 | if(n>0) 8 | { 9 | xp=(xa+xb)/2; 10 | yp=(ya+yb)/2; 11 | xq=(xb+xc)/2; 12 | yq=(yb+yc)/2; 13 | xr=(xc+xa)/2; 14 | yr=(yc+ya)/2; 15 | moveto(xp,yp); 16 | lineto(xq,yq); 17 | lineto(xr,yr); 18 | lineto(xp,yp); 19 | tria(xa,ya,xp,yp,xr,yr,n-1); 20 | tria(xb,yb,xq,yq,xp,yp,n-1); 21 | tria(xc,yc,xr,yr,xq,yq,n-1); 22 | } 23 | } 24 | 25 | void main() 26 | { 27 | int n,xa=10,ya=10,xb=10,yb=470,xc=630,yc=470; 28 | int gdriver=DETECT,gmode; 29 | printf("Input recursion depth( for exmaple, 7): "); 30 | scanf("%d",&n); 31 | initgraph(&gdriver,&gmode,"c:\\tc"); 32 | cleardevice(); 33 | setbkcolor(8); 34 | setcolor(2); 35 | moveto(xa,ya); 36 | lineto(xb,yb); 37 | lineto(xc,yc); 38 | lineto(xa,ya); 39 | tria(xa,ya,xb,yb,xc,yc,n); 40 | getch(); 41 | closegraph(); 42 | } 43 |  -------------------------------------------------------------------------------- /141.图形法绘制椭圆/141.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void ellipse1(x0,y0,a,b,dt) 4 | int x0,y0,a,b,dt; 5 | { 6 | int x,y,n,i; 7 | float t1,t=0.0; 8 | t1=dt*0.0174533; 9 | n=360/dt; 10 | moveto(x0+a,y0); 11 | for(i=1;i 3 | #include 4 | #include 5 | 6 | void parspl(p,n,k,e) 7 | int p[][2],n,k,e; 8 | { 9 | int x,y,i,j,m; 10 | float t1,t2,t3,t,a,b,c,d; 11 | if(e==1) 12 | { 13 | m=n; 14 | p[0][0]=p[1][0]; 15 | p[0][1]=p[1][1]; 16 | p[n+1][0]=p[n][0]; 17 | p[n+1][1]=p[n][1]; 18 | } 19 | else 20 | { 21 | m=n+1; 22 | p[0][0]=p[n][0]; 23 | p[0][1]=p[n][1]; 24 | p[m][0]=p[1][0]; 25 | p[m][1]=p[1][1]; 26 | p[m+1][0]=p[2][0]; 27 | p[m+1][1]=p[2][1]; 28 | } 29 | t=0.5/k; 30 | moveto(p[1][0],p[1][1]); 31 | for(i=0;i> "); 74 | scanf("%s",fname); 75 | if((fp=fopen(fname,"r"))==NULL) 76 | { 77 | printf("File %s does not exist! Do you want to create it? Y/N ",fname); 78 | ch=getch(); 79 | if(ch=='Y'||ch=='y') 80 | { 81 | if((fp=fopen(fname,"w+"))==NULL) 82 | { 83 | printf("\nError! Can't create file %s!",fname); 84 | exit(1); 85 | } 86 | printf("\nPlease input %d pair coordinates (x,y) of the points:\n",n); 87 | for(i=0;i 2 | #include 3 | #include 4 | #include 5 | #include 6 | #define INTR 0x1c 7 | 8 | void interrupt ( *oldhandler) (); 9 | int fre[]={523,659,587,659,587,494,587,523,440,440,440,330,392,440,494,494,330,415,494,523,523,523}; 10 | 11 | void interrupt handler(){ 12 | unsigned i; 13 | static int flag; 14 | static int k=0; 15 | union{ 16 | long divisor; 17 | unsigned char c[2]; 18 | }music; 19 | unsigned char port; 20 | flag++; 21 | if (flag>=4){ 22 | flag=0; 23 | music.divisor=1190000/fre[k]; 24 | outportb(67,182); 25 | outportb(66,music.c[0]); 26 | outportb(66,music.c[1]); 27 | port=inportb(97); 28 | outport(97,port|3); 29 | k++; 30 | if(k>=22) k=1; 31 | } 32 | oldhandler(); 33 | } 34 | 35 | int main(void) 36 | { 37 | int gdriver=9,gmode=2,errorcode; 38 | int midx,midy,i; 39 | oldhandler=getvect(INTR); 40 | setvect(INTR,handler); 41 | /*registerbgidriver( EGAVGA_driver );*/ 42 | initgraph(&gdriver,&gmode,"c:\\tc"); 43 | errorcode=graphresult(); 44 | if(errorcode!=grOk) 45 | { 46 | printf("graphic error:%s\n",grapherrormsg(errorcode)); 47 | printf("press any key to halt"); 48 | getch(); 49 | exit(1); 50 | } 51 | midx=getmaxx()/2; 52 | midy=getmaxy()/2; 53 | for(i=SOLID_FILL;i 2 | #include 3 | void main(void) 4 | { 5 | struct country info; 6 | clrscr(); 7 | puts(" This program is to get the country information:"); 8 | country(0, &info); 9 | 10 | if (info.co_date == 0) 11 | printf(" >> Date format: mm/dd/yy\n"); 12 | else if (info.co_date == 1) 13 | printf(" >> Date format: dd/mm/yy\n"); 14 | else if (info.co_date == 2) 15 | printf(" >> Date format: yy/mm/dd\n"); 16 | 17 | printf(" >> Currency symbol %s\n", info.co_curr); 18 | printf(" >> Decimal separator %s\n", info.co_thsep); 19 | printf(" >> Date separator %s Time separator %s\n", 20 | info.co_dtsep, info.co_tmsep); 21 | 22 | if (info.co_currstyle == 0) 23 | printf(" >> Currency symbol precedes with no leading spaces\n"); 24 | else if (info.co_currstyle == 1) 25 | printf(" >> Currency symbol follows with no spaces\n"); 26 | else if (info.co_currstyle == 2) 27 | printf(" >> Currency symbol precedes with leading space\n"); 28 | if (info.co_currstyle == 4) 29 | printf(" >> Currency symbol follows with space\n"); 30 | 31 | printf(" >> Currency significant digits %d\n", info.co_digits); 32 | 33 | if (info.co_time) 34 | printf(" >> 24 hour time\n"); 35 | else 36 | printf(" >> 12 hour time\n"); 37 | 38 | printf(" >> Data separator %s\n", info.co_dasep); 39 | printf(" Press any key to quit..."); 40 | getch(); 41 | } 42 | 43 | 44 |  -------------------------------------------------------------------------------- /156.修改环境变量/156.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/156.修改环境变量/156.C -------------------------------------------------------------------------------- /157.显示系统文件表/157.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void main(void) 6 | { 7 | union REGS inregs, outregs; 8 | struct SREGS segs; 9 | int i, j; 10 | int structure_size; 11 | struct SystemTableEntry 12 | { 13 | struct SystemTableEntry far *next; /*Next SFT entry*/ 14 | unsigned file_count; /*Files in table*/ 15 | unsigned handle_count; /*Handles to this file*/ 16 | unsigned open_mode; /*File open mode*/ 17 | char file_attribute; /*Attribute byte*/ 18 | unsigned local_remote; /*Bit 15 set means remote*/ 19 | unsigned far *DPD; /*Drive parameter block*/ 20 | unsigned starting_cluster; 21 | unsigned time_stamp; 22 | unsigned date_stamp; 23 | long file_size; 24 | long current_offset; 25 | unsigned relative_cluster; 26 | long directory_sector_number; 27 | char directory_entry_offset; 28 | char filename_ext[11]; /*No period, space padded*/ 29 | /*Ignore SHARE fields for example*/ 30 | } far *table_ptr, far *file; 31 | long far *system_table; 32 | 33 | /*Get DOS version*/ 34 | inregs.x.ax = 0x3001; 35 | intdos (&inregs, &outregs); 36 | if (outregs.h.al < 3) 37 | { 38 | printf("This program requires DOS version 3 or later\n"); 39 | exit (1); 40 | } 41 | else if (outregs.h.al == 3) 42 | structure_size = 0x35; 43 | else if (outregs.h.al >= 4) 44 | structure_size = 0x3B; 45 | /*Get the list of losts pointer*/ 46 | inregs.h.ah = 0x52; 47 | intdosx (&inregs, &outregs, &segs); 48 | /*The pointer to the system file table is at offset 4*/ 49 | system_table = MK_FP(segs.es, outregs.x.bx + 4); 50 | table_ptr = (struct SystemTableEntry far *) *system_table; 51 | do 52 | { 53 | printf("%d entries in table\n", table_ptr->file_count); 54 | for (i = 0; i < table_ptr->file_count; i++) 55 | { 56 | file = MK_FP(FP_SEG(table_ptr), FP_OFF(table_ptr) + 57 | (i * structure_size)); 58 | if (file->handle_count) 59 | { 60 | for (j = 0; j < 8; j++) 61 | if (file->filename_ext[j] != ' ') 62 | putchar(file->filename_ext[j]); 63 | else 64 | break; 65 | if (file->filename_ext[8] != ' ') 66 | putchar('.'); 67 | for (j = 8; j < 11; j++) 68 | if (file->filename_ext[j] != ' ') 69 | putchar(file->filename_ext[j]); 70 | printf (" %ld bytes %x attribute %d references\n", 71 | file->file_size, file->file_attribute, 72 | file->handle_count); 73 | } 74 | } 75 | table_ptr = table_ptr->next; 76 | } while (FP_OFF(table_ptr) != 0xFFFF); 77 | printf(" Press any key to quit..."); 78 | getch(); 79 | return; 80 | } 81 | 82 |  -------------------------------------------------------------------------------- /158.显示目录内容/158.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/158.显示目录内容/158.C -------------------------------------------------------------------------------- /159.读取磁盘文件/159.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/159.读取磁盘文件/159.C -------------------------------------------------------------------------------- /160.删除目录树/160.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void main(int argc, char **argv) 9 | { 10 | void delete_tree(void); 11 | 12 | char buffer[128]; 13 | 14 | char drive[MAXDRIVE], directory[MAXDIR], filename[MAXFILE], ext[MAXEXT]; 15 | 16 | if (argc < 2) 17 | { 18 | printf (" >> Syntax error\n"); 19 | exit(0); 20 | } 21 | 22 | 23 | fnsplit (argv[1], drive, directory, filename, ext); 24 | getcwd (buffer, sizeof(buffer)); 25 | 26 | if (drive[0] == NULL) 27 | { 28 | fnsplit (buffer, drive, directory, filename, ext); 29 | strcpy (buffer, directory); 30 | strcat (buffer, filename); 31 | strcat (buffer, ext); 32 | } 33 | else 34 | { 35 | printf (" >> Do not specify drive letter\n"); 36 | exit (1); 37 | } 38 | 39 | if (strcmpi(buffer, argv[1]) == 0) 40 | { 41 | printf (" >> Cannot delete current directory\n"); 42 | exit (1); 43 | } 44 | 45 | getcwd (directory, 64); 46 | 47 | if (chdir (argv[1])) 48 | printf (" >> Invalid directory %s\n", argv[1]); 49 | else 50 | delete_tree(); 51 | 52 | chdir (directory); 53 | rmdir (argv[1]); 54 | printf(" >> Delete Successful!\n"); 55 | printf(" Press any key to quit..."); 56 | getch(); 57 | return; 58 | } 59 | 60 | union REGS inregs, outregs; 61 | struct SREGS segs; 62 | 63 | void delete_tree(void) 64 | { 65 | struct ffblk fileinfo; 66 | int result; 67 | char far *farbuff; 68 | unsigned dta_seg, dta_ofs; 69 | 70 | result = findfirst("*.*", &fileinfo, 16); 71 | inregs.h.ah = 0x2f; 72 | intdosx (&inregs, &outregs, &segs); 73 | dta_seg = segs.es; 74 | dta_ofs = outregs.x.bx; 75 | 76 | while (! result) 77 | { 78 | if ((fileinfo.ff_attrib & 16) && (fileinfo.ff_name[0] != '.')) 79 | { 80 | inregs.h.ah = 0x1A; 81 | inregs.x.dx = FP_SEG(farbuff); 82 | segread(&segs); 83 | intdosx (&inregs, &outregs, &segs); 84 | 85 | chdir (fileinfo.ff_name); 86 | delete_tree(); 87 | chdir (".."); 88 | 89 | inregs.h.ah = 0x1A; 90 | inregs.x.dx = dta_ofs; 91 | segs.ds = dta_seg; 92 | rmdir (fileinfo.ff_name); 93 | } 94 | else if (fileinfo.ff_name[0] != '.') 95 | { 96 | remove (fileinfo.ff_name); 97 | } 98 | 99 | result = findnext (&fileinfo); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /161.定义文本模式/161.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/161.定义文本模式/161.C -------------------------------------------------------------------------------- /162.设计立体窗口/162.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/162.设计立体窗口/162.C -------------------------------------------------------------------------------- /163.彩色弹出菜单/163.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/163.彩色弹出菜单/163.C -------------------------------------------------------------------------------- /164.读取CMOS信息/164.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void main(void) 6 | { 7 | struct CMOS 8 | { 9 | unsigned char current_second; 10 | unsigned char alarm_second; 11 | unsigned char current_minute; 12 | unsigned char alarm_minute; 13 | unsigned char current_hour; 14 | unsigned char alarm_hour; 15 | unsigned char current_day_of_week; 16 | unsigned char current_day; 17 | unsigned char current_month; 18 | unsigned char current_year; 19 | unsigned char status_registers[4]; 20 | unsigned char diagnostic_status; 21 | unsigned char shutdown_code; 22 | unsigned char drive_types; 23 | unsigned char reserved_x; 24 | unsigned char disk_1_type; 25 | unsigned char reserved; 26 | unsigned char equipment; 27 | unsigned char lo_mem_base; 28 | unsigned char hi_mem_base; 29 | unsigned char hi_exp_base; 30 | unsigned char lo_exp_base; 31 | unsigned char fdisk_0_type; 32 | unsigned char fdisk_1_type; 33 | unsigned char reserved_2[19]; 34 | unsigned char hi_check_sum; 35 | unsigned char lo_check_sum; 36 | unsigned char lo_actual_exp; 37 | unsigned char hi_actual_exp; 38 | unsigned char century; 39 | unsigned char information; 40 | unsigned char reserved3[12]; 41 | } cmos; 42 | 43 | char i; 44 | char *pointer; 45 | char byte; 46 | 47 | pointer = (char *) &cmos; 48 | 49 | for (i = 0; i < 0x34; i++) 50 | { 51 | outportb(0x70, i); 52 | byte = inportb(0x71); 53 | *pointer++ = byte; 54 | } 55 | 56 | clrscr(); 57 | printf(" This program is to get the CMOS infomation.\n"); 58 | printf(" Some of the CMOS information is as follows.\n"); 59 | printf(" >> Current date: %d/%x/%x", cmos.current_month, 60 | cmos.current_day, cmos.century); 61 | if(cmos.current_year<10) 62 | printf("0%d.\n",cmos.current_year); 63 | else 64 | printf("%d.\n",cmos.current_year); 65 | printf(" >> Current time: %d:%d:%d.\n", cmos.current_hour, 66 | cmos.current_minute, cmos.current_second); 67 | printf(" >> Shutdown type: %d.\n", cmos.shutdown_code); 68 | printf(" >> Hard disk type %d\n", cmos.fdisk_0_type); 69 | 70 | printf(" Press any key to quit..."); 71 | getch(); 72 | return; 73 | } 74 |  -------------------------------------------------------------------------------- /165.获取BIOS设备列表/165.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/165.获取BIOS设备列表/165.C -------------------------------------------------------------------------------- /166.锁住硬盘/166.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int main(void) 5 | { 6 | int result; 7 | char a='N'; 8 | char buffer[512]; 9 | clrscr(); 10 | printf(" This is a hard disk lock program.\n"); 11 | printf(" Do you want to lock your hard disk? (Y/N): "); 12 | scanf("%c",&a); 13 | if (a == 'Y'||a=='y') 14 | { 15 | result = biosdisk(2,0x80,0,0,1,1,buffer); 16 | if(result) 17 | { 18 | buffer[510] = 0x0; 19 | buffer[511] = 0x0; 20 | printf(" Fail to read main boot sector!\n"); 21 | } 22 | if(!result) result = biosdisk(3,0x80,0,0,1,1,buffer); 23 | (!result)?(printf(" Writing main boot sector successfully!\n")):(printf(" Fail to write main boot sector!\n")); 24 | } 25 | printf(" Press any key to quit..."); 26 | getch(); 27 | return 0; 28 | } -------------------------------------------------------------------------------- /167.备份恢复硬盘分区表/167.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/167.备份恢复硬盘分区表/167.C -------------------------------------------------------------------------------- /168.设计口令程序/168.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/168.设计口令程序/168.C -------------------------------------------------------------------------------- /169.程序自我保护/169.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/169.程序自我保护/169.C -------------------------------------------------------------------------------- /170.水果拼盘/170.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/170.水果拼盘/170.C -------------------------------------------------------------------------------- /171.小孩吃梨/171.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/171.小孩吃梨/171.C -------------------------------------------------------------------------------- /172.删除字符串中的特定字符/172.C: -------------------------------------------------------------------------------- 1 | #include 2 | int func(char s[],int c) 3 | { 4 | char *q=s; 5 | for(; *q; q++) 6 | if(*q != c) *(s++)=*q; 7 | *s='\0'; 8 | } 9 | void main() 10 | { 11 | static char str[]="Turbo c and borland c++"; 12 | char ch; 13 | clrscr() ; printf(" The string before delete is %s.\n",str); 14 | printf(" Please input the char to delete : "); 15 | scanf("%c",&ch); 16 | func(str,ch); 17 | printf(" The string after delete is %s.\n",str); 18 | printf(" Press any key to quit..."); 19 | getch(); 20 | return; 21 | } 22 | -------------------------------------------------------------------------------- /173.求解符号方程/173.C: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | long int a,b,c,i,j,k; 5 | clrscr(); 6 | for(i=10;i<100;i++) 7 | { 8 | for(j=0;j<=9;j++) 9 | for(k=0;k<=9;k++) 10 | { 11 | a=8*100+j*10+k; 12 | b=97*100+j*10+k; 13 | if((b==i*a+1)&&b>=1000&&b<=10000&&8*i<100&&9*i>=100) 14 | printf("\n %ld=%ld*%ld+%ld",97*100+j*10+k,800+j*10+k,i,b%i); 15 | } 16 | } 17 | printf("\n Press any key to quit..."); 18 | getch(); 19 | return; 20 | } -------------------------------------------------------------------------------- /174.计算标准差/174.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | double fun(double x[10]) 4 | { 5 | int i; 6 | double fc,avg=0.0,sum=0.0,abs=0.0; 7 | for (i=0;i<10;i++) 8 | sum+=x[i]; 9 | avg=sum/10; 10 | for (i=0;i<10;i++) 11 | abs+=(x[i]-avg)*(x[i]-avg); 12 | fc=sqrt(abs/10) ; 13 | return fc; 14 | } 15 | void main() 16 | { 17 | double s, x[10]={95.0,89.0,76.0,65.0,88.0,72.0,85.0,81.0,90.0,56.0}; 18 | int i; 19 | clrscr(); 20 | printf(" The original data is:\n"); 21 | for(i=0;i<10;i++) 22 | printf(" %3.1f",x[i]); 23 | printf("\n The variance of the data is %lf.\n",fun(x)); 24 | printf(" Press any key to quit..."); 25 | getch(); 26 | return; 27 | } 28 | 29 |  -------------------------------------------------------------------------------- /175.求取符合特定要求的素数/175.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int isP(int m) 4 | { 5 | int i ; 6 | for(i = 2 ; i < m ; i++) 7 | if(m % i == 0) return 0 ; 8 | return 1 ; 9 | } 10 | void num(int m,int k,int xx[]) 11 | { 12 | int i=0; 13 | for(m=m+1;k>0;m++) 14 | if(isP(m)) 15 | { 16 | xx[i++]=m; 17 | k--; 18 | } 19 | } 20 | void readwriteDAT() 21 | { 22 | int m, n, xx[1000], i; 23 | FILE *rf, *wf ; 24 | rf = fopen("in171.dat", "r"); 25 | wf = fopen("out171.dat", "w"); 26 | for(i = 0 ; i < 10 ; i++) 27 | { 28 | fscanf(rf,"%d%d",&m,&n); 29 | num(m,n,xx) ; 30 | for(m=0;m < n ; m++) 31 | fprintf(wf, "%d ", xx[m]); 32 | fprintf(wf, "\n"); 33 | } 34 | fclose(rf); 35 | fclose(wf); 36 | } 37 | void main() 38 | { 39 | int m, n, xx[1000] ; 40 | clrscr() ; 41 | puts(" This program is to get k prime numbers which are larger than m."); 42 | printf(" >> Please input two integers to m and k : ") ; 43 | scanf("%d%d", &m, &n ) ; 44 | num(m, n, xx) ; 45 | printf(" >> The %d prime numbers which are larger than %d are:\n ",n,m); 46 | for(m = 0 ; m < n ; m++) 47 | printf(" %d ", xx[m]) ; 48 | readwriteDAT(); 49 | printf("\n Press any key to quit...") ; 50 | getch(); 51 | return; 52 | } 53 | 54 | 55 |  -------------------------------------------------------------------------------- /175.求取符合特定要求的素数/IN175.DAT: -------------------------------------------------------------------------------- 1 | 80 5 2 | 180 6 3 | 280 7 4 | 380 8 5 | 480 9 6 | 580 10 7 | 680 11 8 | 780 12 9 | 880 13 10 | 980 14 11 | -------------------------------------------------------------------------------- /175.求取符合特定要求的素数/OUT1715.DAT: -------------------------------------------------------------------------------- 1 | 83 89 97 101 103 2 | 181 191 193 197 199 211 3 | 281 283 293 307 311 313 317 4 | 383 389 397 401 409 419 421 431 5 | 487 491 499 503 509 521 523 541 547 6 | 587 593 599 601 607 613 617 619 631 641 7 | 683 691 701 709 719 727 733 739 743 751 757 8 | 787 797 809 811 821 823 827 829 839 853 857 859 9 | 881 883 887 907 911 919 929 937 941 947 953 967 971 10 | 983 991 997 1009 1013 1019 1021 1031 1033 1039 1049 1051 1061 1063 11 | -------------------------------------------------------------------------------- /176.统计符合特定条件的数/176.C: -------------------------------------------------------------------------------- 1 | #include 2 | #define MAX 200 3 | int a[MAX], b[MAX], cnt = 0; 4 | void jsVal() 5 | { 6 | int bb[4]; 7 | int I,j,k,flag; 8 | for (I=0;I<200;I++) 9 | { 10 | bb[0]=a[I]/1000; 11 | bb[1]=a[I]%1000/100; 12 | bb[2]=a[I]%100/10; 13 | bb[3]=a[I]%10; 14 | for (j=0;j<4;j++) 15 | { 16 | if (bb[j]%2==0) 17 | flag=1; 18 | else 19 | { 20 | flag=0; 21 | break; 22 | } 23 | } 24 | if (flag==1) 25 | { 26 | b[cnt]=a[I]; 27 | cnt++; 28 | } 29 | } 30 | for(I=0;I=index;j--) 25 | { 26 | ch=xx[I][strl-1]; 27 | for(k=strl-1;k>0;k--) 28 | xx[I][k]=xx[I][k-1]; 29 | xx[I][0]=ch; 30 | } 31 | } 32 | } 33 | void main() 34 | { 35 | clrscr(); 36 | if(ReadDat()) 37 | { 38 | printf("Can't open the file!\n"); 39 | return; 40 | } 41 | StrOR(); 42 | WriteDat(); 43 | system("pause"); 44 | } 45 | int ReadDat(void) 46 | { 47 | FILE *fp;int i=0;char *p; 48 | if((fp=fopen("in173.dat","r"))==NULL) return 1; 49 | while(fgets(xx[i],80,fp)!=NULL) 50 | { 51 | p=strchr(xx[i],'\n'); 52 | if(p) 53 | *p=0; 54 | i++; 55 | } 56 | maxline=i; 57 | fclose(fp); 58 | return 0; 59 | } 60 | void WriteDat(void) 61 | { 62 | FILE *fp; 63 | int i; 64 | fp=fopen("out173.dat","w"); 65 | for(i=0;i 2 | #include 3 | #include 4 | int aa[200],bb[10]; 5 | void jsSort() 6 | { 7 | int I,j,data; 8 | for(I=0;I<199;I++) 9 | for(j=I+1;j<200;j++) 10 | {if (aa[I]%1000>aa[j]%1000) 11 | {data=aa[I];aa[I]=aa[j];aa[j]=data;} 12 | else if(aa[I]%1000==aa[j]%1000) 13 | if(aa[I] 2 | char xx[100][11]; 3 | int yy[10]; 4 | int ReadDat(void); 5 | void WriteDat(void); 6 | void CountRs(void) 7 | { 8 | int i,j,k; 9 | for(i=0;i<100;i++) 10 | { 11 | k=0; 12 | for(j=0;j<10;j++) 13 | if(xx[i][j]=='1') 14 | k++; 15 | if(k==0||k==10) 16 | continue; 17 | for(j=0;j<10;j++) 18 | if(xx[i][j]=='1') 19 | yy[j]++; 20 | } 21 | } 22 | void main() 23 | { 24 | int i; 25 | for(i=0;i<10;i++) yy[i]=0; 26 | if(ReadDat()) 27 | { 28 | printf("Can't open file IN183.DAT!\n\007" ); 29 | return; 30 | } 31 | CountRs(); 32 | WriteDat(); 33 | system("pause"); 34 | } 35 | int ReadDat(void) 36 | { 37 | FILE *fp; 38 | int i; 39 | char tt[13]; 40 | clrscr(); 41 | if((fp=fopen("in183.dat","r" ))==NULL) return 1; 42 | for(i=0;i<100;i++) 43 | { 44 | if(fgets(tt,13,fp)==NULL)return 1; 45 | memcpy(xx[i],tt,10); 46 | xx[i][10]=0; 47 | } 48 | fclose(fp); 49 | return 0; 50 | } 51 | void WriteDat(void) 52 | { 53 | FILE *fp; 54 | int i; 55 | fp=fopen("out183.dat","w" ); 56 | for(i=0;i<10;i++) 57 | { 58 | fprintf(fp," %d\n",yy[i]); 59 | printf(" NO.%2d notes=%d\n" ,i+1,yy[i]); 60 | } 61 | fclose(fp); 62 | } 63 |  -------------------------------------------------------------------------------- /181.求解三角方程/IN181.DAT: -------------------------------------------------------------------------------- 1 | 0010110111 2 | 1010101100 3 | 1000110000 4 | 1011100000 5 | 1011101001 6 | 1011101101 7 | 1111010111 8 | 1001101011 9 | 1100001011 10 | 0111100110 11 | 0111101110 12 | 0011001110 13 | 0100101111 14 | 1111101001 15 | 1111001001 16 | 1101101011 17 | 1110100100 18 | 1001000111 19 | 0110110110 20 | 0001010001 21 | 0010111010 22 | 1101000011 23 | 0011010011 24 | 1011001110 25 | 1110110111 26 | 1000110111 27 | 0000110000 28 | 1000110101 29 | 0100011001 30 | 0000000101 31 | 1100100110 32 | 1011110001 33 | 1000001111 34 | 1111000001 35 | 0011110111 36 | 0111001010 37 | 1100110010 38 | 1110011100 39 | 0110100111 40 | 0101110111 41 | 1010001000 42 | 1000010011 43 | 0000011010 44 | 1001100101 45 | 0010111011 46 | 1101011010 47 | 0101101111 48 | 0011000111 49 | 0110010110 50 | 1100000011 51 | 0110011100 52 | 0011011110 53 | 1111000001 54 | 0111110011 55 | 0101001010 56 | 0110001010 57 | 1110111101 58 | 0010000111 59 | 0011110011 60 | 0100010010 61 | 1000100011 62 | 0100000010 63 | 0100111010 64 | 0000110000 65 | 0100011001 66 | 1000111010 67 | 0010001010 68 | 1101100001 69 | 0100010101 70 | 1010000011 71 | 0111110011 72 | 1001101011 73 | 0011010110 74 | 1011011100 75 | 0101000001 76 | 1000101110 77 | 0010011111 78 | 1001011001 79 | 0001011110 80 | 0010110000 81 | 0010110110 82 | 0111010000 83 | 0111101010 84 | 1101100100 85 | 1100011110 86 | 1111000111 87 | 0100011001 88 | 1110111011 89 | 0010010000 90 | 0010011110 91 | 1011001100 92 | 0111101101 93 | 0011000000 94 | 1011111001 95 | 1111110011 96 | 1000001001 97 | 0111001110 98 | 0001110001 99 | 0100100010 100 | 1100111011 101 | -------------------------------------------------------------------------------- /181.求解三角方程/OUT181.DAT: -------------------------------------------------------------------------------- 1 | 48 2 | 50 3 | 55 4 | 49 5 | 50 6 | 51 7 | 48 8 | 44 9 | 61 10 | 55 11 | -------------------------------------------------------------------------------- /182.新完全平方数/182.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | float countvalue() 5 | { 6 | float x0,x1=0.0; 7 | while(1) 8 | { 9 | x0=x1; 10 | x1=cos(x0); 11 | if(fabs(x0-x1)<1e-6) 12 | break; 13 | } 14 | return x1; 15 | } 16 | void PressKeyToQuit() 17 | { 18 | printf("\n Press any key to quit..."); 19 | getch(); 20 | return; 21 | } 22 | main() 23 | { 24 | clrscr(); 25 | puts(" This program is to find the real root of"); 26 | puts(" function cos(x)-x=0."); 27 | printf(" >> The real root is %f.\n",countvalue()); 28 | printf(" >> The result of cos(%f)-%f is %f.\n",countvalue(),countvalue(),cos(countvalue())-countvalue()); 29 | writeDat(); 30 | PressKeyToQuit(); 31 | } 32 | writeDat() 33 | { 34 | FILE *wf; 35 | wf=fopen("OUT179.DAT","w"); 36 | fprintf(wf,"%f\n",countvalue()); 37 | fclose(wf); 38 | } 39 |  -------------------------------------------------------------------------------- /182.新完全平方数/OUT182.DAT: -------------------------------------------------------------------------------- 1 | 0.739085 2 | -------------------------------------------------------------------------------- /183.三重回文数/183.C: -------------------------------------------------------------------------------- 1 | #include 2 | int jsvalue(int bb[]) 3 | { 4 | int I,j,k=0; 5 | int hun,ten,data; 6 | for(I=100;I<=999;I++) 7 | { 8 | j=10; 9 | while(j*j<=I) 10 | { 11 | if (I==j*j) 12 | { 13 | hun=I/100;data=I-hun*100; 14 | ten=data/10;data=data-ten*10; 15 | if(hun==ten||hun==data||ten==data) 16 | { 17 | bb[k]=I; 18 | k++; 19 | } 20 | } 21 | j++; 22 | } 23 | } 24 | return k; 25 | } 26 | void PressKeyToQuit() 27 | { 28 | printf("\n Press any key to quit..."); 29 | getch(); 30 | return; 31 | } 32 | main() 33 | { 34 | int b[20],num; 35 | clrscr(); 36 | puts(" This program is to find the Perfect Square Numbers."); 37 | puts(" which have 3 digits, and 2 of them are the same."); 38 | puts(" These numbers are as follows:"); 39 | num=jsvalue(b); 40 | writeDat(num,b); 41 | PressKeyToQuit(); 42 | } 43 | writeDat(int num,int b[]) 44 | { 45 | FILE *out; 46 | int i; 47 | out=fopen("out180.dat","w"); 48 | fprintf(out,"%d\n",num); 49 | for(i=0;i 2 | int jsvalue(long n) 3 | { 4 | int I,strl,half; 5 | char xy[20]; 6 | ltoa(n,xy,10); 7 | strl=strlen(xy); 8 | half=strl/2; 9 | for(I=0;I=half) return 1; 13 | else return 0; 14 | } 15 | void PressKeyToQuit() 16 | { 17 | printf("\n Press any key to quit..."); 18 | getch(); 19 | return; 20 | } 21 | main() 22 | { 23 | long m; 24 | FILE *out; 25 | clrscr(); 26 | puts(" This program is to find the Palindrome Numbers."); 27 | puts(" whose square and cubic are also Palindrome Numbers."); 28 | puts(" >> These numbers less than 1000 are:"); 29 | out=fopen("out181.dat","w"); 30 | for(m=11;m<1000;m++) 31 | { 32 | if(jsvalue(m)&&jsvalue(m*m)&&jsvalue(m*m*m)) 33 | { 34 | printf(" m=%4ld,m*m=%6ld,m*m*m=%8ld \n",m,m*m,m*m*m); 35 | fprintf(out,"m=%4ld,m*m=%6ld,m*m*m=%8ld \n",m,m*m,m*m*m); 36 | } 37 | } 38 | fclose(out); 39 | PressKeyToQuit(); 40 | } 41 | -------------------------------------------------------------------------------- /184.奇数方差/OUT184.DAT: -------------------------------------------------------------------------------- 1 | m= 11,m*m= 121,m*m*m= 1331 2 | m= 101,m*m= 10201,m*m*m= 1030301 3 | m= 111,m*m= 12321,m*m*m= 1367631 4 | -------------------------------------------------------------------------------- /185.统计选票/185.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #define MAX 1000 5 | int xx[MAX],odd=0,even=0; 6 | double ave1=0.0,ave2=0.0,totfc=0.0; 7 | void WriteDat(void); 8 | int ReadDat(void) 9 | { 10 | FILE *fp; 11 | int i,j; 12 | if((fp=fopen("IN182.DAT","r"))==NULL) 13 | return 1; 14 | for(i=0;i<100;i++) 15 | { 16 | for(j=0;j<10;j++) 17 | fscanf(fp, "%d ", &xx[i*10+j]); 18 | fscanf(fp, "\n"); 19 | if(feof(fp)) 20 | break; 21 | } 22 | fclose(fp); 23 | return 0; 24 | } 25 | void Compute(void) 26 | { 27 | int I, yy[MAX]; 28 | for(I=0;I<1000;I++) 29 | if(xx[I]%2) 30 | { 31 | odd++; 32 | ave1+=xx[I]; 33 | yy[odd-1]=xx[I]; 34 | } 35 | else 36 | { 37 | even++; 38 | ave2+=xx[I]; 39 | } 40 | ave1/=odd; 41 | ave2/=even; 42 | for(I=0;I> The results are:"); 57 | for(i=0;i 2 | #include 3 | void countvalue(int *a,int *n) 4 | { 5 | int I; 6 | *n=0; 7 | for(I=1;I<=1000;I++) 8 | if(I%7==0&&I%11) 9 | { 10 | *a=I; 11 | *n=*n+1; 12 | a++; 13 | } 14 | else if(I%7&&I%11==0) 15 | { 16 | *a=I; 17 | *n=*n+1; 18 | a++; 19 | } 20 | } 21 | void PressKeyToQuit() 22 | { 23 | printf("\n Press any key to quit..."); 24 | getch(); 25 | return; 26 | } 27 | main() 28 | { 29 | int aa[1000],n,k; 30 | clrscr(); 31 | puts(" This program is to find numbers\n which can be divided exactly by 7 or 11,\n but can not be divided exactly both by 7 and 11."); 32 | puts(" These numbers less than 1000 are:"); 33 | countvalue(aa,&n); 34 | for(k=0;k 2 | #include 3 | #define MAXNUM 200 4 | int xx[MAXNUM]; 5 | int totnum=0; 6 | int totcnt=0; 7 | double totpjz=0.0; 8 | int readdat(void); 9 | void writedat(void); 10 | void calvalue(void) 11 | { 12 | int i,data; 13 | for(i=0;i0) totnum++; 17 | data=xx[i]>>1; 18 | if(data%2==0) 19 | { 20 | totcnt++; 21 | totpjz+=xx[i]; 22 | } 23 | } 24 | totpjz/=totcnt; 25 | } 26 | void PressKeyToQuit() 27 | { 28 | printf("\n Press any key to quit..."); 29 | getch(); 30 | return; 31 | } 32 | void main() 33 | { 34 | int i; 35 | clrscr(); 36 | puts(" This program is to execute Bit Shift Operation."); 37 | puts(" >> Now reading datas from file......Succeeded!"); 38 | puts(" >> Calculating......Completed!"); 39 | puts(" >> Results are:"); 40 | for(i=0;i> The total number of data in the file is %d.\n",totnum); 48 | printf(" >> The even number of data after bit shift is %d.\n",totcnt); 49 | printf(" >> The variance of these even numbers is %.2lf\n",totpjz); 50 | writedat(); 51 | PressKeyToQuit(); 52 | } 53 | int readdat(void) 54 | { 55 | FILE *fp; 56 | int i=0; 57 | if((fp=fopen("in188.dat","r"))==NULL) return 1; 58 | while(!feof(fp)) 59 | fscanf(fp,"%d",&xx[i++]); 60 | fclose(fp); 61 | return 0; 62 | } 63 | void writedat(void) 64 | { 65 | FILE *fp; 66 | fp=fopen("out188.dat","w"); 67 | fprintf(fp,"%d\n%d\n%.2lf\n",totnum,totcnt,totpjz); 68 | fclose(fp); 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /189.数字移位/IN189.DAT: -------------------------------------------------------------------------------- 1 | 1001 2 | 2001 3 | 1012 4 | 1034 5 | 1067 6 | 1111 7 | 1166 8 | 1232 9 | 1309 10 | 1397 11 | 1496 12 | 1506 13 | 1527 14 | 1559 15 | 1602 16 | 1656 17 | 1721 18 | 1797 19 | 1884 20 | 1982 21 | 2091 22 | 2111 23 | 2142 24 | 2184 25 | 2237 26 | 2301 27 | 2376 28 | 2462 29 | 2559 30 | 2667 31 | 2786 32 | 2816 33 | 2857 34 | 2909 35 | 2972 36 | 3046 37 | 3131 38 | 3227 39 | 3334 40 | 3452 41 | 3581 42 | 3621 43 | 3672 44 | 3734 45 | 3807 46 | 3891 47 | 3986 48 | 4092 49 | 4209 50 | 4337 51 | 4476 52 | 4526 53 | 4587 54 | 4659 55 | 4742 56 | 4836 57 | 4941 58 | 5057 59 | 5184 60 | 5322 61 | 5471 62 | 5531 63 | 5602 64 | 5684 65 | 5777 66 | 5881 67 | 5996 68 | 6122 69 | 6259 70 | 6407 71 | 6566 72 | 6636 73 | 6717 74 | 6809 75 | 6912 76 | 7026 77 | 7151 78 | 7287 79 | 7434 80 | 7592 81 | 7761 82 | 7841 83 | 7932 84 | 8034 85 | 8147 86 | 8271 87 | 8406 88 | 8552 89 | 8709 90 | 8877 91 | 9056 92 | 9146 93 | 9247 94 | 9359 95 | 9482 96 | 9616 97 | 9761 98 | 9917 99 | 8084 100 | 8262 101 | 8451 102 | 8551 103 | 8662 104 | 8784 105 | 8917 106 | 1061 107 | 1216 108 | 1382 109 | 1559 110 | 1747 111 | 1946 112 | 2056 113 | 2177 114 | 2309 115 | 2452 116 | 2606 117 | 2771 118 | 2947 119 | 3134 120 | 3332 121 | 3541 122 | 3661 123 | 3792 124 | 3934 125 | 4087 126 | 4251 127 | 4426 128 | 4612 129 | 4809 130 | 5017 131 | 5236 132 | 5366 133 | 5507 134 | 5659 135 | 5822 136 | 5996 137 | 6181 138 | 6377 139 | 6584 140 | 6802 141 | 7031 142 | 7171 143 | 7322 144 | 7484 145 | 7657 146 | 7841 147 | 8036 148 | 8242 149 | 8459 150 | 8687 151 | 8926 152 | 9076 153 | 9237 154 | 9409 155 | 9592 156 | 9786 157 | 9991 158 | 8207 159 | 8434 160 | 8672 161 | 8921 162 | 1081 163 | 1252 164 | 1434 165 | 1627 166 | 1831 167 | 2046 168 | 2272 169 | 2509 170 | 2757 171 | 3016 172 | 3186 173 | 3367 174 | 3559 175 | 3762 176 | 3976 177 | 4201 178 | 4437 179 | 4684 180 | 4942 181 | 5211 182 | 5391 183 | 5582 184 | 5784 185 | 5997 186 | -------------------------------------------------------------------------------- /189.数字移位/OUT189.DAT: -------------------------------------------------------------------------------- 1 | 185 2 | 93 3 | 4932.55 4 | -------------------------------------------------------------------------------- /190.统计最高成绩/190.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define N 10 4 | void readwritedat(); 5 | typedef struct ss{ 6 | char num[10]; 7 | int s; 8 | }STU; 9 | mmm(STU a[],int n,STU *s) 10 | { 11 | int i; 12 | s->s=a[0].s; 13 | for(i=1;is->s) 15 | *s=a[i]; 16 | } 17 | void PressKeyToQuit() 18 | { 19 | printf("\n Press any key to quit..."); 20 | getch(); 21 | return; 22 | } 23 | void sort(STU a[],int n) 24 | { 25 | STU t; 26 | int i,j; 27 | for(i=0;i 2 | 3 | char *fun ( char *s, char *t) 4 | { 5 | char *ss=s, *tt=t; 6 | while((*ss)&&(*tt)) 7 | { ss++; tt++; } 8 | if(*tt) return(t); 9 | else return(s); 10 | } 11 | 12 | main( ) 13 | { char a[20],b[10],*p,*q; 14 | int i; 15 | printf("Input 1th string:") ; 16 | gets( a); 17 | printf("Input 2th string:") ; 18 | gets( b); 19 | printf("%s\n",fun (a, b )); 20 | } 21 | -------------------------------------------------------------------------------- /192.合并整数/192.C: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fun(int a, int b, long *c) 4 | { 5 | *c=a/10*10+a%10*1000+b/10*100+b%10; 6 | } 7 | main() 8 | { int a,b; long c; 9 | printf("Input a, b:"); 10 | scanf("%d%d", &a, &b); 11 | fun(a, b, &c); 12 | printf("The result is: %ld\n", c); 13 | } 14 | -------------------------------------------------------------------------------- /193.矩阵逆置/193.C: -------------------------------------------------------------------------------- 1 | ]) 2 | { 3 | int i,j,t; 4 | for(i=0; i < 3; i++) 5 | for(j=0; j < i; j++) 6 | { t=array[i][j]; 7 | array[i][j]=array[j][i]; 8 | array[j][i]=t; } 9 | 10 | } 11 | main() 12 | { 13 | int i,j; 14 | int array[3][3]={{100,200,300}, 15 | {400,500,600}, 16 | {700,800,900}}; 17 | 18 | for (i=0; i < 3; i++) 19 | { for (j=0; j < 3; j++) 20 | printf("%7d",array[i][j]); 21 | printf("\n"); 22 | } 23 | fun(array); 24 | printf("Converted array:\n"); 25 | for (i=0; i < 3; i++) 26 | { for (j=0; j < 3; j++) 27 | printf("%7d",array[i][j]); 28 | printf("\n"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /194.删除指定的字符/194.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/194.删除指定的字符/194.C -------------------------------------------------------------------------------- /195.括号匹配/195.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/195.括号匹配/195.C -------------------------------------------------------------------------------- /196.字符串逆置/196.C: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #define N 81 4 | fun ( char *s ) 5 | { 6 | strrev(s); 7 | } 8 | main( ) 9 | { char a[N]; 10 | printf ( "Enter a string : " ); gets ( a ); 11 | printf ( "The original string is : " ); puts( a ); 12 | fun ( a ); 13 | printf("\n"); 14 | printf ( "The string after modified : "); 15 | puts ( a ); 16 | } 17 | -------------------------------------------------------------------------------- /197.SIX、NINE问题/197.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/197.SIX、NINE问题/197.C -------------------------------------------------------------------------------- /198.单词个数统计/198.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/198.单词个数统计/198.C -------------------------------------------------------------------------------- /199.方差运算/199.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/199.方差运算/199.C -------------------------------------------------------------------------------- /200.级数运算/200.C: -------------------------------------------------------------------------------- 1 | #include 2 | int b[3]; 3 | jsValue() 4 | {int a1=1,a2=1,a12,sn,k=2; 5 | sn=a1+a2; 6 | while(1) 7 | {a12=a1+2*a2; 8 | if(sn<100&&sn+a12>=100) b[0]=k; 9 | if(sn<1000&&sn+a12>=1000) b[1]=k; 10 | if(sn<10000&&sn+a12>=10000) {b[2]=k;break;} 11 | sn=sn+a12; 12 | a1=a2;a2=a12; 13 | k++; 14 | } 15 | } 16 | 17 | main() 18 | { 19 | jsValue(); 20 | printf("M=100,n=%d\nM=1000,n=%d\nM=10000,n=%d\n",b[0],b[1],b[2]); 21 | } 22 | -------------------------------------------------------------------------------- /201.输出素数/201.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int isP(int m) 4 | { 5 | int i; 6 | for(i=2;i0;m++) 15 | 16 | if(isP(m)) { xx[s++]=m; k--;} 17 | } 18 | main() 19 | { 20 | int m,n,xx[1000]; 21 | printf("\nPlease enter two integers:"); 22 | scanf("%d%d",&m,&n); 23 | num(m,n,xx); 24 | for(m=0;m 2 | jsValue(int a[10][9]) 3 | { int i,j,k,val,num; 4 | for(i=0;i<10;i++) 5 | { val=a[i][0]; 6 | for(j=0;j<9;j++) 7 | if(a[i][j]0;k--) 10 | a[i][k]=a[i][k-1]; 11 | a[i][0]=num; 12 | } 13 | } 14 | } 15 | main() 16 | { 17 | int a[10][9]={{6,8,9,1,2,5,4,7,3}, 18 | {3,5,8,9,1,2,6,4,7}, 19 | {8,2,1,9,3,5,4,6,7}, 20 | {3,5,1,2,9,8,6,7,4}, 21 | {4,7,8,9,1,2,5,3,6}, 22 | {4,7,3,5,1,2,6,8,9}, 23 | {9,1,3,5,8,6,2,4,7}, 24 | {2,6,1,9,8,3,5,7,4}, 25 | {5,3,7,9,1,8,2,6,4}, 26 | {7,1,3,2,5,8,9,4,6}, 27 | }; 28 | int i,j; 29 | jsValue(a); 30 | for(i=0;i<10;i++){ 31 | for(j=0;j<9;j++) { 32 | printf("%d",a[i][j]); 33 | if(j<=7)printf(","); 34 | } 35 | printf("\n"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /204.整数各位数字排序/204.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/204.整数各位数字排序/204.C -------------------------------------------------------------------------------- /205.字符串字母移位/205.C: -------------------------------------------------------------------------------- 1 | #include 2 | #define N 81 3 | 4 | void chg(char *s) 5 | {while(*s) 6 | if(*s=='z'||*s=='Z') {*s-=25; s++;} 7 | else if(*s>='a'&&*s<='y') {*s+=1;s++;} 8 | else if(*s>='A'&&*s<='Y') {*s+=1;s++;} 9 | else s++; 10 | } 11 | 12 | main( ) 13 | { 14 | char a[N]; 15 | 16 | printf("Enter a string : "); gets(a); 17 | printf("The original string is : "); puts(a); 18 | chg(a); 19 | printf("The string after modified : "); 20 | puts (a); 21 | } 22 | -------------------------------------------------------------------------------- /206.Fibonacc数列/206.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | float countvalue() 5 | { 6 | float x0,x1=0.0; 7 | while(1) 8 | { 9 | x0=x1; 10 | x1=cos(x0); 11 | if(fabs(x0-x1)<1e-6) 12 | break; 13 | } 14 | return x1; 15 | } 16 | void PressKeyToQuit() 17 | { 18 | printf("\n Press any key to quit..."); 19 | getch(); 20 | return; 21 | } 22 | main() 23 | { 24 | clrscr(); 25 | puts(" This program is to find the real root of"); 26 | puts(" function cos(x)-x=0."); 27 | printf(" >> The real root is %f.\n",countvalue()); 28 | printf(" >> The result of cos(%f)-%f is %f.\n",countvalue(),countvalue(),cos(countvalue())-countvalue()); 29 | writeDat(); 30 | PressKeyToQuit(); 31 | } 32 | writeDat() 33 | { 34 | FILE *wf; 35 | wf=fopen("OUT179.DAT","w"); 36 | fprintf(wf,"%f\n",countvalue()); 37 | fclose(wf); 38 | } 39 |  -------------------------------------------------------------------------------- /206.Fibonacc数列/OUT206.DAT: -------------------------------------------------------------------------------- 1 | 0.739085 2 | -------------------------------------------------------------------------------- /207.商人过河游戏/207.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/207.商人过河游戏/207.C -------------------------------------------------------------------------------- /208.吃数游戏/208.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/208.吃数游戏/208.C -------------------------------------------------------------------------------- /209.解救人质游戏/209.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/209.解救人质游戏/209.C -------------------------------------------------------------------------------- /210.打字训练游戏/210.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/210.打字训练游戏/210.C -------------------------------------------------------------------------------- /210.打字训练游戏/others.dat: -------------------------------------------------------------------------------- 1 | 123,45,6,78,9.0-,2108,435,89.679132,~@!!4%^^&*(@#$!@#*&^(&^#$%@$!@$%&^%*&^@#$%!@!#@$<>@#45,.;[]-=\230-203`12098-46829437978123894/*123409-0.216834958123-081084591-72934;/,.230984`-23409;123,/456-089`237890-`732489345m.123-7497815.m,098132578zcja085314311/`.,2308`39841983275-97`289-473-4368`4.,/.082387091';09`821034!@#@#%#$&%^*(,/.,123097@!$465978!@#4790813#$^$%&%&!@#%@&%^80198=3260!#@%/,.;'l[]12-93][][{}{}9-531324%&$#[]12340\132{}9-=239134%^$-9123478-917239-4823476-9123459-80,/.,/,123471-9739-8`0`830=48129=46!@#$@!$^#*^717-83501!#@535&3213556@#!#@%28014$@5!#50-7493-01jl;akjfop72jla;siuf09132784;lasf91832509170491=;a'kdgj0835a;,gda/rk]oao]qero185[]a[\-1\=034lajdf":}P=1023519(*^%)+-24350^%^+(\214351=08)+(&0=124396k;sfdg092]46ka;dti-=21381=0235';kgjd-=13i5;adsmkg09q325[kjp;'dsai8g091=32k5';dsagu-5jladngmi87-35781km;gasodjf0=1395-1\=3295723496-=29\34=kz;dkmgwap9egi2438650=1msa'ktj21-=5j19375=2459m'.lvm, /0iav32q45m zx09 akfq[ a70r9q83kjadu0 q038=21a';kod0=21345 n0129385^)(*^_&+&%)*\23=50^)82=-34jgas913jps8=24,v048 m10=,v \346]dj=20\sh'g|\23i4kh|2p4[6 |wkrpy\=+)*(_+\||i-324,sfd;klh0=25ma 'a0935\fc1,\5169\229\-2485[o a']29=51780=598ty"L:"-\234689;kldsg]41\3:":L[210\{}Iyuoap 091ck;dsifo=15'akjsf0346^_(&52\6sgj20468u=aj'dgi20=4368'akgjdq-=685'z q39785=15piads97-`0=5qj[goa~810=385';lsd8t~!~79-53~@!$%#^*0497`@%47`9-274!~#%`7-8420`jfla8kc`m[ 7`0843m` 0`984=iuamd09f81325/a;lsod0f1325u'8dg013j'fjdq-hgOD;UG2=4J';ODSAIG I-W0KA'80218=5176=4@$^!!^^%!%79-`7~#~#%)HA;SKLDFJ105NLDIUFG913~#$%?@*%> 12 | #include 13 | #include 14 | #include 15 | 16 | #include "tdecfg.h" 17 | #include "cfghelp.h" 18 | 19 | extern struct vcfg cfg; 20 | extern FILE *tde_exe; /* FILE pointer to tde.exe */ 21 | extern long help_offset; 22 | 23 | static WINDOW *w_ptr; 24 | 25 | 26 | /******** EXTREMELY IMPORTANT ************/ 27 | /* 28 | * If you modify tde, it is your responsibility to find the offset of 29 | * the help screen in your new executable, tde.exe. 30 | * 31 | */ 32 | 33 | 34 | 35 | /* 36 | * Name: tdehelp 37 | * Date: October 1, 1991 38 | * Notes: Set up most of the window global variables. 39 | */ 40 | void tdehelp( void ) 41 | { 42 | int c; 43 | int i; 44 | char line[200]; 45 | char out_line[82]; 46 | char fname[82]; 47 | char *rc; 48 | FILE *help_file; /* FILE pointer to help screen */ 49 | long offset; 50 | 51 | 52 | cls( ); 53 | show_box( 0, 0, help_screen, NORMAL ); 54 | xygoto( 42, 14 ); 55 | c = getkey( ); 56 | while (c != '1' && c != '2') 57 | c = getkey( ); 58 | if (c == '1') { 59 | puts( "" ); 60 | puts( "" ); 61 | puts( "" ); 62 | puts( "Enter file name that contains new help screen :" ); 63 | gets( fname ); 64 | if ((c = access( fname, EXIST )) != 0) { 65 | puts( "\nFile not found. Press any key to continue." ); 66 | c = getkey( ); 67 | cls( ); 68 | return; 69 | } else if ((help_file = fopen( fname, "r" )) == NULL ) { 70 | puts( "\nCannot open help file. Press any key to contine." ); 71 | c = getkey( ); 72 | cls( ); 73 | return; 74 | } 75 | offset = help_offset + 8; 76 | rc = fgets( line, 100, help_file ); 77 | for (c=0; c<25 && rc != NULL; c++) { 78 | memset( out_line, '\0', 82 ); 79 | for (i=0; i<80 && line[i] != '\n'; i++) 80 | out_line[i] = line[i]; 81 | fseek( tde_exe, offset, SEEK_SET ); 82 | fwrite( out_line, sizeof( char ), 81, tde_exe ); 83 | offset += 81; 84 | rc = fgets( line, 100, help_file ); 85 | } 86 | fclose( help_file ); 87 | puts( "" ); 88 | puts( "" ); 89 | puts( "" ); 90 | puts( "New help screen successfully installed. Press any key to continue." ); 91 | c = getkey( ); 92 | } 93 | cls( ); 94 | } 95 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/CFGHELP.H: -------------------------------------------------------------------------------- 1 | /* 2 | * New editor name: tde, the Thomson-Davis Editor. 3 | * Author: Frank Davis 4 | * Date: June 5, 1991 5 | * 6 | * Show all available keys the function connected to each key. 7 | */ 8 | 9 | struct screen help_screen[] = { 10 | {1,0,"This utility reads the new help screen from a file. The file must" }, 11 | {2,0,"exist before running this utility. The file should contain an image" }, 12 | {3,0,"of the new help screen, which is 80 columns wide and 25 lines long." }, 13 | {4,0,"A sample help file, sample.hlp, was included with this editor." }, 14 | {5,0,"You may modify the sample help file to display your new key definitions"}, 15 | {6,0,"or you may create your own help file. The file name will be prompted." }, 16 | {10,20,"1. Install a new help screen."}, 17 | {12,20,"2. Exit"}, 18 | {14,15,"Please enter your choice: "}, 19 | {0,0,NULL} 20 | }; 21 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/CFGKEYS.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/CFGKEYS.H -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/CFGMACRO.C: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "tdecfg.h" 9 | #include "cfgmacro.h" 10 | 11 | extern struct vcfg cfg; 12 | extern FILE *tde_exe; /* FILE pointer to tde.exe */ 13 | extern long macro_offset; 14 | 15 | static WINDOW *w_ptr; 16 | 17 | MACRO macros; 18 | 19 | /******** EXTREMELY IMPORTANT ************/ 20 | /* 21 | * If you modify tde, it is your responsibility to find the offset of 22 | * the macro buffer in your new executable, tde.exe. 23 | * 24 | */ 25 | 26 | 27 | 28 | /* 29 | * Name: tdehelp 30 | * Date: October 1, 1991 31 | * Notes: Set up most of the window global variables. 32 | */ 33 | void tdemacro( void ) 34 | { 35 | int c; 36 | char fname[82]; 37 | FILE *macro_file; /* FILE pointer to macro */ 38 | 39 | 40 | cls( ); 41 | show_box( 0, 0, macro_screen, NORMAL ); 42 | xygoto( 42, 14 ); 43 | c = getkey( ); 44 | while (c != '1' && c != '2') 45 | c = getkey( ); 46 | if (c == '1') { 47 | puts( "" ); 48 | puts( "" ); 49 | puts( "" ); 50 | puts( "Enter file name that contains the macro definitions :" ); 51 | gets( fname ); 52 | if ((c = access( fname, EXIST )) != 0) { 53 | puts( "\nFile not found. Press any key to continue." ); 54 | c = getkey( ); 55 | cls( ); 56 | return; 57 | } else if ((macro_file = fopen( fname, "rb" )) == NULL ) { 58 | puts( "\nCannot open macro file. Press any key to contine." ); 59 | c = getkey( ); 60 | cls( ); 61 | return; 62 | } 63 | 64 | fread( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, macro_file ); 65 | fread( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, macro_file ); 66 | fseek( tde_exe, macro_offset + 8, SEEK_SET ); 67 | fwrite( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, tde_exe ); 68 | fwrite( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, tde_exe ); 69 | fclose( macro_file ); 70 | puts( "" ); 71 | puts( "" ); 72 | puts( "" ); 73 | puts( "New macros successfully installed. Press any key to continue." ); 74 | c = getkey( ); 75 | } 76 | cls( ); 77 | } 78 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/CFGMACRO.H: -------------------------------------------------------------------------------- 1 | /* 2 | * New editor name: tde, the Thomson-Davis Editor. 3 | * Author: Frank Davis 4 | * Date: June 5, 1991 5 | * 6 | */ 7 | 8 | 9 | struct screen macro_screen[] = { 10 | {1,0,"This utility reads an existing macro file. The file must exist" }, 11 | {2,0,"before running this utility. If you create a few favorite macros" }, 12 | {3,0,"in tde and save them to a file, you may use this utility to store" }, 13 | {4,0,"them in tde.exe, so that those macros will be available each time" }, 14 | {5,0,"you use tde."}, 15 | {10,20,"1. Install a macro file."}, 16 | {12,20,"2. Exit"}, 17 | {14,15,"Please enter your choice: "}, 18 | {0,0,NULL} 19 | }; 20 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/CFGMODES.H: -------------------------------------------------------------------------------- 1 | /* 2 | * cursor size 3 | */ 4 | #define SMALL_INS 0 5 | #define BIG_INS 1 6 | 7 | 8 | /* 9 | * flags used for opening files in binary or text mode. 10 | * CRLF is for opening files in text mode - Operating System converts 11 | * LF to CRLF automatically. in binary mode, LF is not translated. 12 | */ 13 | #define CRLF 1 14 | #define LF 2 15 | 16 | 17 | char *mode_screen[] = { 18 | " Default editor modes ", 19 | " ", 20 | " Insert/Overwrite mode: ", 21 | " Indent mode: ", 22 | " Physical Tab Size: ", 23 | " Logical Tab Size: ", 24 | " Smart tab mode: ", 25 | " ^Z at end of file: ", 26 | " End of line on file output: ", 27 | " Trailing space: ", 28 | " Display end of line character: ", 29 | " Word wrap mode: ", 30 | " Left margin: ", 31 | " Paragraph margin: ", 32 | " Right margin: ", 33 | " Insert cursor size: ", 34 | " Create .bak backup files: ", 35 | " Ruler at top of window: ", 36 | " Date style: ", 37 | " Time style: ", 38 | " Initial search\\sort case: ", 39 | " ", 40 | " \x1b, \x1a = change values \x18, \x19 = move cursor F3 = Quit F10 = Save and Quit", 41 | NULL 42 | }; 43 | 44 | 45 | struct { 46 | int line; 47 | int col; 48 | int mode; 49 | void (*show_me)( void ); 50 | } mode[19] = { 51 | { 3, 36, 0, show_insert_mode }, 52 | { 4, 36, 0, show_indent_mode }, 53 | { 5, 36, 0, show_ptabsize }, 54 | { 6, 36, 0, show_ltabsize }, 55 | { 7, 36, 0, show_smart_mode }, 56 | { 8, 36, 0, show_controlz }, 57 | { 9, 36, 0, show_eol_out }, 58 | { 10, 36, 0, show_trail }, 59 | { 11, 36, 0, show_eol_display }, 60 | { 12, 36, 0, show_ww }, 61 | { 13, 36, 0, show_left }, 62 | { 14, 36, 0, show_para }, 63 | { 15, 36, 0, show_right }, 64 | { 16, 36, 0, show_cursor_size }, 65 | { 17, 36, 0, show_backup_mode }, 66 | { 18, 36, 0, show_ruler_mode }, 67 | { 19, 36, 0, show_date_style }, 68 | { 20, 36, 0, show_time_style }, 69 | { 21, 36, 0, show_initcase } 70 | }; 71 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/COMMON.H: -------------------------------------------------------------------------------- 1 | /******************* start of original comments ********************/ 2 | /* 3 | * Written by Douglas Thomson (1989/1990) 4 | * 5 | * This source code is released into the public domain. 6 | */ 7 | /********************* end of original comments ********************/ 8 | 9 | 10 | /* 11 | * New editor name: TDE, the Thomson-Davis Editor. 12 | * Author: Frank Davis 13 | * Date: June 5, 1991 14 | * 15 | * This modification of Douglas Thomson's code is released into the 16 | * public domain, Frank Davis. You may distribute it freely. 17 | * 18 | * This file contains all the external structure declarations common 19 | * to all the editor modules. Being stupid, I can't remember which 20 | * extern prompts or structures are used by which file. let's combine 21 | * them in one file, so I don't have to remember. 22 | */ 23 | 24 | /* 25 | * Some of variables are used again and again throughout the editor. 26 | * Gather them into logical structures and make them global to all 27 | * modules. 28 | */ 29 | extern displays g_display; 30 | 31 | extern status_infos g_status; 32 | 33 | extern boyer_moore_type bm; 34 | 35 | extern boyer_moore_type sas_bm; 36 | 37 | extern REGX_INFO regx; 38 | 39 | extern REGX_INFO sas_regx; 40 | 41 | extern NFA_TYPE nfa; 42 | 43 | extern NFA_TYPE sas_nfa; 44 | 45 | extern mode_infos mode; 46 | 47 | extern KEY_FUNC key_func; 48 | 49 | extern MACRO macro; 50 | 51 | extern CEH ceh; 52 | 53 | extern SORT sort; 54 | 55 | extern SORT_ORDER sort_order; 56 | 57 | extern DIFF diff; 58 | 59 | extern MACRO_STACK macro_stack[]; /* small, simple stack for calls */ 60 | 61 | extern TWO_KEY two_key_list; 62 | 63 | extern COLORS colour; 64 | 65 | extern char *regx_help[]; 66 | 67 | extern int (* (do_it[NUM_FUNCS]))( WINDOW * ); 68 | 69 | /* 70 | * extern definitions for all prompts 71 | */ 72 | 73 | extern char *cb; 74 | 75 | extern char *block1; 76 | extern char *ltol; 77 | extern char *block2; 78 | extern char *block3a; 79 | extern char *block3b; 80 | extern char *block4; 81 | extern char *block5; 82 | extern char *block6; 83 | extern char *block7; 84 | extern char *block8; 85 | extern char *block9; 86 | extern char *block10; 87 | extern char *block11; 88 | extern char *block12; 89 | extern char *block13; 90 | extern char *block14; 91 | extern char *block15; 92 | extern char *block16; 93 | extern char *block17; 94 | extern char *block18; 95 | extern char *block20; 96 | extern char *block21; 97 | extern char *block22a; 98 | extern char *block22b; 99 | extern char *block23; 100 | extern char *block24; 101 | extern char *block25; 102 | extern char *block26; 103 | 104 | 105 | extern char *critt1; 106 | 107 | 108 | extern char *diff_prompt1; 109 | extern char *diff_prompt2; 110 | extern char *diff_prompt3; 111 | extern char *diff_prompt4; 112 | extern char *diff_prompt5; 113 | extern char *diff_prompt6a; 114 | extern char *diff_prompt6b; 115 | extern char *diff_prompt7a; 116 | extern char *diff_prompt7b; 117 | extern char *diff_prompt7c; 118 | extern char *diff_prompt7d; 119 | 120 | extern char *diff_message; 121 | extern char *diff_blank; 122 | 123 | 124 | extern char *dir1; 125 | extern char *dir2; 126 | extern char *stardotstar; 127 | extern char *dir3; 128 | extern char *dir4; 129 | extern char *dir5; 130 | extern char *dir6; 131 | extern char *dir7; 132 | 133 | 134 | extern char *ed1; 135 | extern char *ed2; 136 | extern char *ed3; 137 | extern char *ed4; 138 | extern char *ed5; 139 | 140 | extern char *ed7a; 141 | extern char *ed7b; 142 | extern char *ed8; 143 | extern char *ed9; 144 | extern char *ed10; 145 | extern char *ed11; 146 | extern char *ed12; 147 | extern char *ed13; 148 | extern char *ed14; 149 | extern char *ed15; 150 | extern char *ed16; 151 | extern char *ed17; 152 | 153 | extern char *paused1; 154 | extern char *paused2; 155 | 156 | 157 | extern char *find1; 158 | extern char *find2; 159 | extern char *find3; 160 | extern char *find4; 161 | extern char *find5a; 162 | extern char *find5b; 163 | extern char *find6; 164 | extern char *find7[]; 165 | extern char *find8; 166 | extern char *find9; 167 | extern char *find10; 168 | extern char *find11; 169 | extern char *find12; 170 | 171 | 172 | extern char *smart; 173 | extern char *fixed; 174 | extern char *intab; 175 | extern char *outtab; 176 | extern char *tabs; 177 | extern char *indent; 178 | extern char *blank; 179 | extern char *ignore; 180 | extern char *match; 181 | extern char *sync_off; 182 | extern char *sync_on; 183 | extern char *ww_mode[]; 184 | extern char *eol_mode[]; 185 | 186 | 187 | extern char *main1; 188 | extern char *main2; 189 | extern char *main3; 190 | extern char *main4; 191 | extern char *main5; 192 | extern char *main6; 193 | extern char *main7a; 194 | extern char *main7b; 195 | extern char *main8a; 196 | extern char *main8b; 197 | extern char *main9; 198 | extern char *main10a; 199 | extern char *main10b; 200 | extern char *main11; 201 | extern char *main12; 202 | extern char *main13; 203 | extern char *main14; 204 | extern char *main15; 205 | 206 | extern char *main18; 207 | extern char *main19; 208 | extern char *main20; 209 | extern char *main21; 210 | extern char *main22; 211 | 212 | 213 | extern char *reg1; 214 | extern char *reg2; 215 | extern char *reg3; 216 | extern char *reg4; 217 | extern char *reg5; 218 | extern char *reg6; 219 | extern char *reg7; 220 | extern char *reg8; 221 | extern char *reg9; 222 | extern char *reg10; 223 | extern char *reg11; 224 | 225 | 226 | extern char *utils1; 227 | 228 | extern char *utils3; 229 | extern char *utils4; 230 | extern char *utils5; 231 | 232 | extern char *utils6; 233 | extern char *utils7a; 234 | extern char *utils7b; 235 | extern char *utils8; 236 | extern char *utils9; 237 | extern char *utils10; 238 | extern char *utils11; 239 | extern char *utils12; 240 | extern char *utils13; 241 | extern char *utils14; 242 | extern char *utils15; 243 | 244 | extern char *utils16; 245 | 246 | extern char *win1; 247 | extern char *win2; 248 | extern char *win3; 249 | extern char *win4; 250 | extern char *win5; 251 | extern char *win6; 252 | extern char *win7; 253 | extern char *win8; 254 | extern char *win9; 255 | extern char *win16a; 256 | extern char *win16b; 257 | extern char *win17; 258 | extern char *win18; 259 | extern char *win19; 260 | 261 | 262 | extern char *ww1; 263 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/CRITERR.C: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | #include "tdestr.h" 4 | #include "common.h" 5 | #include "tdefunc.h" 6 | #include "criterr.h" 7 | 8 | /* 9 | * Save the area of the screen that will display the Critical 10 | * Error info. CEH_WIDTH and CEH_HEIGHT are the dimensions of critical 11 | * error screen in criterr.h. CEH_OFFSET is the offset into the screen 12 | * refresh buffer. Let the compiler calculate the offset, 'cause the offset 13 | * don't change anyway. 14 | */ 15 | #define CEH_ROW 5 16 | #define CEH_COL 6 17 | #define CEH_WIDTH 69 18 | #define CEH_HEIGHT 15 19 | 20 | #define CEH_OFFSET ((CEH_ROW * 160) + (CEH_COL * 2)) 21 | 22 | #define NEXT_LINE 160 23 | 24 | 25 | /* 26 | * buffer for ceh info screen. make this an int array because we 27 | * need to save character and attribute. 28 | */ 29 | int ceh_buffer[CEH_HEIGHT][CEH_WIDTH]; 30 | 31 | 32 | /* 33 | * Name: crit_err_handler 34 | * Purpose: Show user something is wrong and get a response 35 | * Date: April 1, 1992 36 | */ 37 | int far crit_err_handler( void ) 38 | { 39 | int rc; 40 | int c; 41 | 42 | save_area( (char far *)ceh_buffer ); 43 | show_error_screen( CEH_ROW, CEH_COL ); 44 | xygoto( 60, 17 ); 45 | do 46 | c = getkey( ); 47 | while (c != 'Q' && c != 'q' && c != 'R' && c != 'r' && c != 'A' && c != 'a'); 48 | switch ( c ) { 49 | case 'A': 50 | case 'a': 51 | rc = ABORT; 52 | break; 53 | case 'Q': 54 | case 'q': 55 | rc = FAIL; 56 | break; 57 | case 'R': 58 | case 'r': 59 | default : 60 | rc = RETRY; 61 | break; 62 | } 63 | restore_area( (char far *)ceh_buffer ); 64 | return( rc ); 65 | } 66 | 67 | 68 | /* 69 | * Name: show_error_screen 70 | * Purpose: Display error screen in window 71 | * Date: April 1, 1992 72 | * Passed: row: line to display ceh screen 73 | * col: column to begin display ceh screen 74 | */ 75 | void show_error_screen( int row, int col ) 76 | { 77 | char **p; 78 | 79 | for (p=criterr_screen; *p != NULL; p++, row++) 80 | s_output( *p, row, col, g_display.help_color ); 81 | s_output( error_code[ceh.code], 8, 23, g_display.help_color ); 82 | s_output( operation[ceh.rw], 9, 23, g_display.help_color ); 83 | if (ceh.dattr == 0) 84 | c_output( ceh.drive + 'a', 23, 10, g_display.help_color ); 85 | else 86 | s_output( critt1, 10, 23, g_display.help_color ); 87 | s_output( ext_err[ceh.extended], 11, 23, g_display.help_color ); 88 | s_output( error_class[ceh.class], 12, 23, g_display.help_color ); 89 | s_output( locus[ceh.locus], 13, 23, g_display.help_color ); 90 | s_output( device_type[ceh.dattr], 14, 23, g_display.help_color ); 91 | s_output( ceh.dattr == 0 ? critt1 : ceh.dname, 92 | 15, 23, g_display.help_color ); 93 | } 94 | 95 | 96 | /* 97 | * Name: save_area 98 | * Purpose: save a region of the screen 99 | * Date: April 1, 1992 100 | * Passed: dest: pointer to buffer for contents of screen under ceh 101 | * Notes: this function does not check for snow. the source is the screen 102 | * and the destination is the buffer. 103 | */ 104 | void save_area( char far *dest ) 105 | { 106 | char far *source; 107 | register int hgt; 108 | 109 | source = (char far *)g_display.display_address + CEH_OFFSET; 110 | for (hgt=CEH_HEIGHT; hgt; hgt--) { 111 | _fmemcpy( dest, source, CEH_WIDTH*2 ); 112 | source += NEXT_LINE; 113 | dest += (CEH_WIDTH*2); 114 | } 115 | } 116 | 117 | 118 | /* 119 | * Name: restore_area 120 | * Purpose: restore a region of the screen 121 | * Date: April 1, 1992 122 | * Passed: source: pointer to buffer for contents of screen under ceh 123 | * Notes: this function does not check for snow. the source is the buffer 124 | * and the destination is the screen. 125 | */ 126 | void restore_area( char far *source ) 127 | { 128 | char far *dest; 129 | register int hgt; 130 | 131 | dest = (char far *)g_display.display_address + CEH_OFFSET; 132 | for (hgt=CEH_HEIGHT; hgt; hgt--) { 133 | _fmemcpy( dest, source, CEH_WIDTH*2 ); 134 | dest += NEXT_LINE; 135 | source += (CEH_WIDTH*2); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/CRITERR.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/CRITERR.H -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/DESC.SDI: -------------------------------------------------------------------------------- 1 | PUBLIC DOMAIN text editor with C source code... 2 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/DIRLIST.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/DIRLIST.C -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/ED.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/ED.C -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/FILE.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/FILE.C -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/FILE_ID.DIZ: -------------------------------------------------------------------------------- 1 | PUBLIC DOMAIN text editor with C 2 | source code... 3 |  -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/FINDREP.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/FINDREP.C -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/GLOBAL.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/GLOBAL.H -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/HELP.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/HELP.H -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/LIU: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/MACRO.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/MACRO.C -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/MAIN.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/MAIN.C -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/MAKECFG: -------------------------------------------------------------------------------- 1 | # 2 | # Compilers supported == MSC 5.1, MSC 6.0ax, MSC 7.0, QC 2.5, and BCC 3.1 3 | # Makes supported == Microsoft's nmake and Borland's make 4 | # 5 | # To make TDECFG with Microsoft compilers, change the defines and type: 6 | # 7 | # nmake makecfg 8 | # 9 | # To make TDECFG with Borland's make, change the appropriate defines and type: 10 | # 11 | # make -f maketde 12 | # 13 | 14 | 15 | PROJ = tdecfg 16 | 17 | 18 | # 19 | # Define your favorite compiler last 20 | # 21 | COMPILER = QUICKC 22 | COMPILER = BCC 23 | COMPILER = MSC 24 | 25 | 26 | # 27 | # Assertions may be turned off or on. I usually leave assertions on. 28 | # 29 | ASSERTIONS = ON 30 | ASSERTIONS = OFF 31 | ASSERT = TDE 32 | !IF "$(ASSERTIONS)" == "OFF" 33 | !UNDEF ASSERT 34 | !ENDIF 35 | 36 | 37 | # 38 | # Compiler and linker flags and switches. 39 | # 40 | !IF "$(COMPILER)" == "MSC" 41 | CC = cl 42 | !IFDEF ASSERT 43 | CFLAGS = /c /AS /W4 /Ot /D__MSC__ 44 | !ELSE 45 | CFLAGS = /c /AS /W4 /Ot /Gs /D__MSC__ /DNDEBUG 46 | !ENDIF 47 | LINK = link 48 | LFLAGS = /STACK:8196 /NOI 49 | 50 | !ELSE 51 | !IF "$(COMPILER)" == "QUICKC" 52 | CC = qcl 53 | !IFDEF ASSERT 54 | CFLAGS = /c /AS /D__MSC__ /Ot /W4 55 | !ELSE 56 | CFLAGS = /c /AS /D__MSC__ /Ot /W4 /DNDEBUG 57 | !ENDIF 58 | LINK = qlink 59 | LFLAGS = /STACK:8196 /NOI 60 | 61 | !ELSE 62 | !IF "$(COMPILER)" == "BCC" 63 | CC = bcc 64 | !IFDEF ASSERT 65 | CFLAGS = -c -G -ms -O2 -tDe -w -N 66 | !ELSE 67 | CFLAGS = -c -G -ms -O2 -tDe -w -DNDEBUG 68 | !ENDIF 69 | LINK = tlink 70 | LFLAGS = /Td /c 71 | 72 | !ELSE 73 | !ERROR I only know how to make MSC, QuickC, and BCC. 74 | !ENDIF 75 | !ENDIF 76 | !ENDIF 77 | 78 | 79 | # 80 | # Define the compiler rules 81 | # 82 | .c.obj : 83 | $(CC) $(CFLAGS) $< 84 | 85 | 86 | # 87 | # List the dependent obj files 88 | # 89 | CFGOBJS = tdecfg.obj cfgcolor.obj cfgfile.obj cfghelp.obj cfgkeys.obj\ 90 | cfgmacro.obj cfgmodes.obj 91 | 92 | all: $(PROJ).exe 93 | 94 | 95 | # 96 | # List the rules for the obj files. 97 | # 98 | tdecfg.obj : tdecfg.c tdecfg.h 99 | 100 | cfgcolor.obj : cfgcolor.c tdecfg.h cfgcolor.h 101 | 102 | cfgfile.obj : cfgfile.c tdecfg.h cfgfile.h 103 | 104 | cfghelp.obj : cfghelp.c tdecfg.h cfghelp.h 105 | 106 | cfgkeys.obj : cfgkeys.c tdecfg.h cfgkeys.h 107 | 108 | cfgmacro.obj : cfgmacro.c tdecfg.h cfgmacro.h 109 | 110 | cfgmodes.obj : cfgmodes.c tdecfg.h cfgmodes.h 111 | 112 | 113 | # 114 | # Once we get everything compiled, link with either Microsoft or Borland stuff. 115 | # Incidentally, blank lines are significant for the linker response files. 116 | # 117 | !IF "$(COMPILER)" == "BCC" 118 | $(PROJ).exe : $(CFGOBJS) 119 | $(LINK) $(LFLAGS) @&&% 120 | C0S $(CFGOBJS) 121 | $* 122 | 123 | CS.LIB 124 | % 125 | !ELSE 126 | $(PROJ).exe : $(CFGOBJS) 127 | echo >NUL @<<$(PROJ).crf 128 | tdecfg.obj+ 129 | cfgcolor.obj+ 130 | cfgfile.obj+ 131 | cfghelp.obj+ 132 | cfgkeys.obj+ 133 | cfgmacro.obj+ 134 | cfgmodes.obj 135 | $(PROJ).EXE 136 | 137 | 138 | 139 | << 140 | ilink -a -e "$(LINK) $(LFLAGS) @$(PROJ).crf" $(PROJ) 141 | !ENDIF 142 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/MAKETDE: -------------------------------------------------------------------------------- 1 | # 2 | # Compilers supported == MSC 5.1, MSC 6.0ax, MSC 7.0, QC 2.5, and BCC 3.1 3 | # Makes supported == Microsoft's nmake and Borland's make 4 | # 5 | # To make TDE with Microsoft compilers, change the defines as needed and type: 6 | # 7 | # nmake maketde 8 | # 9 | # To make TDE with Borland's make, change the appropriate defines and type: 10 | # 11 | # make -f maketde 12 | # 13 | # Incidentally, Borland requires about twice as much room for 14 | # assertions as Microsoft. If the DGROUP is violated, either 15 | # comment out some assertions in the TDE source code or turn 16 | # assertions off altogether. 17 | 18 | 19 | PROJ = tde 20 | 21 | 22 | # 23 | # Define your favorite compiler last 24 | # 25 | COMPILER = QUICKC 26 | COMPILER = BCC 27 | COMPILER = MSC 28 | 29 | 30 | # 31 | # Define your favorite assembler last 32 | # 33 | ASSEMBLER = MASM51 34 | ASSEMBLER = QUICKASSEMBLER 35 | ASSEMBLER = TASM 36 | ASSEMBLER = MASM6 37 | 38 | 39 | # 40 | # Assertions may be turned off or on. I usually leave assertions on. 41 | # 42 | ASSERTIONS = ON 43 | ASSERTIONS = OFF 44 | ASSERT = TDE 45 | !IF "$(ASSERTIONS)" == "OFF" 46 | !UNDEF ASSERT 47 | !ENDIF 48 | 49 | 50 | # 51 | # Compiler and linker flags and switches. 52 | # 53 | !IF "$(COMPILER)" == "MSC" 54 | CC = cl 55 | !IFDEF ASSERT 56 | CFLAGS = /c /AM /W4 /Ot /D__MSC__ 57 | !ELSE 58 | CFLAGS = /c /AM /W4 /Ot /Gs /D__MSC__ /DNDEBUG 59 | !ENDIF 60 | LINK = link 61 | LFLAGS = /STACK:5632 /NOI 62 | 63 | !ELSE 64 | !IF "$(COMPILER)" == "QUICKC" 65 | CC = qcl 66 | !IFDEF ASSERT 67 | CFLAGS = /c /AM /D__MSC__ /Ot /W4 68 | !ELSE 69 | CFLAGS = /c /AM /D__MSC__ /Ot /W4 /DNDEBUG 70 | !ENDIF 71 | LINK = qlink 72 | LFLAGS = /STACK:5632 /NOI 73 | 74 | !ELSE 75 | !IF "$(COMPILER)" == "BCC" 76 | CC = bcc 77 | !IFDEF ASSERT 78 | CFLAGS = -c -G -mm -O2 -tDe -w -N 79 | !ELSE 80 | CFLAGS = -c -G -mm -O2 -tDe -w -DNDEBUG 81 | !ENDIF 82 | LINK = tlink 83 | LFLAGS = /Td /c 84 | 85 | !ELSE 86 | !ERROR I only know how to make MSC, QuickC, and BCC. 87 | !ENDIF 88 | !ENDIF 89 | !ENDIF 90 | 91 | 92 | # 93 | # Assembler flags and switches. 94 | # 95 | !IF "$(ASSEMBLER)" == "MASM51" 96 | AS = MASM 97 | AFLAGS = /c /MX 98 | 99 | !ELSE 100 | 101 | !IF "$(ASSEMBLER)" == "MASM6" 102 | AS = ML 103 | AFLAGS = /c /Cp /Zm 104 | 105 | !ELSE 106 | !IF "$(ASSEMBLER)" == "QUICKASSEMBLER" 107 | AS = QCL 108 | AFLAGS = /c 109 | 110 | !ELSE 111 | !IF "$(ASSEMBLER)" == "TASM" 112 | AS = TASM 113 | AFLAGS = /Mx 114 | !ELSE 115 | !ERROR I only know how to make MASM, QuickAssembler, and TASM. 116 | !ENDIF 117 | !ENDIF 118 | !ENDIF 119 | !ENDIF 120 | 121 | 122 | # 123 | # Define the compiler and assembler rules 124 | # 125 | .c.obj : 126 | $(CC) $(CFLAGS) $< 127 | 128 | .asm.obj : 129 | $(AS) $(AFLAGS) $< 130 | 131 | 132 | # 133 | # List the dependent obj files 134 | # 135 | TDEOBJS = block.obj console.obj criterr.obj diff.obj dirlist.obj ed.obj\ 136 | file.obj findrep.obj hwind.obj main.obj macro.obj port.obj\ 137 | regx.obj sort.obj tab.obj tdeasm.obj utils.obj window.obj\ 138 | wordwrap.obj int24.obj simul101.obj 139 | 140 | 141 | all: $(PROJ).exe 142 | 143 | 144 | # 145 | # List the rules for the obj files. 146 | # 147 | BLOCK.obj : BLOCK.c tdestr.h common.h tdefunc.h define.h 148 | 149 | CONSOLE.obj : CONSOLE.c tdestr.h common.h tdefunc.h define.h 150 | 151 | CRITERR.obj : CRITERR.c tdestr.h common.h tdefunc.h define.h criterr.h 152 | 153 | DIFF.obj : DIFF.c tdestr.h common.h tdefunc.h define.h 154 | 155 | DIRLIST.obj : DIRLIST.c tdestr.h common.h define.h tdefunc.h 156 | 157 | ED.obj : ED.c tdestr.h global.h tdefunc.h define.h default.h prompts.h 158 | 159 | FILE.obj : FILE.c tdestr.h common.h tdefunc.h define.h 160 | 161 | FINDREP.obj : FINDREP.c tdestr.h common.h tdefunc.h define.h 162 | 163 | HWIND.obj : HWIND.c tdestr.h common.h tdefunc.h define.h 164 | 165 | MACRO.obj : MACRO.C tdestr.h common.h tdefunc.h define.h 166 | 167 | MAIN.obj : MAIN.c tdestr.h common.h tdefunc.h define.h default.h help.h 168 | 169 | PORT.obj : PORT.c tdestr.h common.h tdefunc.h define.h 170 | 171 | REGX.obj : REGX.c tdestr.h common.h tdefunc.h define.h 172 | 173 | SORT.obj : SORT.c tdestr.h common.h tdefunc.h define.h 174 | 175 | TAB.obj : TAB.c tdestr.h common.h tdefunc.h define.h 176 | 177 | TDEASM.obj : TDEASM.c tdestr.h common.h tdefunc.h define.h 178 | 179 | UTILS.obj : UTILS.c tdestr.h common.h tdefunc.h define.h 180 | 181 | WINDOW.obj : WINDOW.c tdestr.h common.h tdefunc.h define.h 182 | 183 | WORDWRAP.obj : WORDWRAP.c tdestr.h common.h tdefunc.h define.h 184 | 185 | int24.obj : int24.asm 186 | 187 | simul101.obj : simul101.asm 188 | 189 | 190 | # 191 | # Once we get everything compiled, link with either Microsoft or Borland stuff. 192 | # Incidentally, blank lines are significant for the linker response files. 193 | # 194 | # Borland linker 195 | # 196 | !IF "$(COMPILER)" == "BCC" 197 | $(PROJ).exe : $(TDEOBJS) 198 | $(LINK) $(LFLAGS) @&&% 199 | C0M $(TDEOBJS) 200 | $* 201 | 202 | CM.LIB 203 | % 204 | !ELSE 205 | # 206 | # Microsoft linker 207 | # 208 | $(PROJ).exe : $(TDEOBJS) 209 | echo >NUL @<<$(PROJ).crf 210 | block.obj+ 211 | console.obj+ 212 | criterr.obj+ 213 | diff.obj+ 214 | dirlist.obj+ 215 | ed.obj+ 216 | file.obj+ 217 | findrep.obj+ 218 | hwind.obj+ 219 | macro.obj+ 220 | main.obj+ 221 | port.obj+ 222 | regx.obj+ 223 | sort.obj+ 224 | tab.obj+ 225 | tdeasm.obj+ 226 | utils.obj+ 227 | window.obj+ 228 | wordwrap.obj+ 229 | simul101.obj+ 230 | int24.obj 231 | $(PROJ).EXE 232 | 233 | 234 | 235 | << 236 | ilink -a -e "$(LINK) $(LFLAGS) @$(PROJ).crf" $(PROJ) 237 | !ENDIF 238 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/PORT.C: -------------------------------------------------------------------------------- 1 | 2 | #include "tdestr.h" 3 | #include "common.h" 4 | #include "tdefunc.h" 5 | #include "define.h" 6 | 7 | 8 | /* 9 | * Name: my_malloc 10 | * Purpose: malloc from the far heap 11 | * Date: April 1, 1993 12 | * Passed: mem: pointer to memory to free in far heap 13 | * rc: pointer to return code 14 | * Notes: set the return code only if an ERROR occured with malloc. 15 | * returning a NULL pointer is not neccessarily an ERROR. 16 | */ 17 | void far * my_malloc( size_t size, int *rc ) 18 | { 19 | void far *mem; 20 | 21 | assert( size < MAX_LINE_LENGTH ); 22 | 23 | if (size == 0) 24 | 25 | /* 26 | * if 0 bytes are requested, return NULL 27 | */ 28 | mem = NULL; 29 | else { 30 | 31 | #if defined( __MSC__ ) 32 | mem = _fmalloc( size ); 33 | #else 34 | mem = farmalloc( size ); 35 | #endif 36 | 37 | /* 38 | * if malloc failed, return NULL and an ERROR. 39 | */ 40 | if (mem == NULL) 41 | *rc = ERROR; 42 | } 43 | return( mem ); 44 | } 45 | 46 | 47 | /* 48 | * Name: my_free 49 | * Purpose: free memory from the far heap 50 | * Date: April 1, 1993 51 | * Passed: mem: pointer to memory to free in far heap 52 | */ 53 | void my_free( void far *mem ) 54 | { 55 | assert( mem != NULL ); 56 | 57 | #if defined( __MSC__ ) 58 | _ffree( mem ); 59 | #else 60 | farfree( mem ); 61 | #endif 62 | } 63 | 64 | 65 | /* 66 | * Name: my_findfirst 67 | * Purpose: find the first file matching a pattern using DOS interrupt 68 | * Date: January 6, 1992 69 | * Passed: dta: disk transfer address 70 | * path: path to search for files 71 | * f_attr: attributes of files to search for 72 | * Notes: return codes for my_findfirst: 73 | * 0 no error 74 | * 2 file is invalid or does not exist 75 | * 3 path is invalid or does not exist 76 | * 18 no matching directory entry was found 77 | * -1 check the critical error flag for critical errors 78 | */ 79 | int my_findfirst( DTA far *dta, char far *path, int f_attr ) 80 | { 81 | void far *old_dta; 82 | void far *new_dta; 83 | int rc; 84 | 85 | new_dta = (void far *)dta; 86 | 87 | ASSEMBLE { 88 | 89 | /* 90 | ; save the old dta 91 | */ 92 | mov ah, 0x2f /* DOS get dta */ 93 | int 0x21 /* DOS interrupt */ 94 | mov WORD PTR old_dta, bx /* save OFFSET of old DTA */ 95 | mov ax, es 96 | mov WORD PTR old_dta+2, ax /* save SEGMENT of old DTA */ 97 | 98 | /* 99 | ; set the new dta 100 | */ 101 | push ds /* save ds */ 102 | mov dx, WORD PTR new_dta /* get OFFSET of new dta */ 103 | mov ax, WORD PTR new_dta+2 /* get SEGMENT of new dta */ 104 | mov ds, ax /* put it in ds */ 105 | mov ah, 0x1a /* DOS set dta */ 106 | int 0x21 /* DOS interrupt */ 107 | pop ds /* get back ds */ 108 | 109 | /* 110 | ; find first matching file 111 | */ 112 | push ds /* save ds */ 113 | mov cx, WORD PTR f_attr /* file attributes to search for */ 114 | mov dx, WORD PTR path /* get OFFSET of path */ 115 | mov ax, WORD PTR path+2 /* get SEGMENT of path */ 116 | mov ds, ax /* put it in ds */ 117 | mov ah, 0x4e /* DOS find first file */ 118 | int 0x21 /* DOS interrupt */ 119 | pop ds /* get back ds */ 120 | 121 | /* 122 | ; save the return code 123 | */ 124 | jc an_error /* carry is set if an error occured */ 125 | xor ax, ax /* zero out ax, return OK if no error */ 126 | } 127 | an_error: 128 | 129 | ASSEMBLE { 130 | mov WORD PTR rc, ax /* save the return code */ 131 | 132 | /* 133 | ; get back old dta 134 | */ 135 | push ds /* save ds */ 136 | mov dx, WORD PTR old_dta /* get OFFSET of old dta */ 137 | mov ax, WORD PTR old_dta+2 /* get SEGMENT of old dta */ 138 | mov ds, ax /* put it in ds */ 139 | mov ah, 0x1a /* DOS set dta */ 140 | int 0x21 /* DOS interrupt */ 141 | pop ds /* get back ds */ 142 | } 143 | if (ceh.flag == ERROR) 144 | rc = ERROR; 145 | return( rc ); 146 | } 147 | 148 | 149 | /* 150 | * Name: my_findnext 151 | * Purpose: find the next file matching a pattern using DOS interrupt 152 | * Date: January 6, 1992 153 | * Passed: dta: disk transfer address 154 | * Notes: my_findfirst() MUST be called before calling this function. 155 | * return codes for my_findnext (see DOS tech ref manuals): 156 | * 0 no error 157 | * 2 path is invalid or does not exist 158 | * 18 no matching directory entry was found 159 | * -1 check the critical error flag for critical errors 160 | */ 161 | int my_findnext( DTA far *dta ) 162 | { 163 | void far *old_dta; 164 | void far *new_dta; 165 | int rc; 166 | 167 | new_dta = (void far *)dta; 168 | 169 | ASSEMBLE { 170 | 171 | /* 172 | ; save the old dta 173 | */ 174 | mov ah, 0x2f /* DOS get dta */ 175 | int 0x21 /* DOS interrupt */ 176 | mov WORD PTR old_dta, bx /* save OFFSET of old DTA */ 177 | mov ax, es 178 | mov WORD PTR old_dta+2, ax /* save SEGMENT of old DTA */ 179 | 180 | /* 181 | ; set the new dta 182 | */ 183 | push ds /* save ds */ 184 | mov dx, WORD PTR new_dta /* get OFFSET of new dta */ 185 | mov ax, WORD PTR new_dta+2 /* get SEGMENT of new dta */ 186 | mov ds, ax /* put it in ds */ 187 | mov ah, 0x1a /* DOS set dta */ 188 | int 0x21 /* DOS interrupt */ 189 | pop ds /* get back ds */ 190 | 191 | /* 192 | ; find next matching file 193 | */ 194 | mov ah, 0x4f /* DOS find first file */ 195 | int 0x21 /* DOS interrupt */ 196 | 197 | /* 198 | ; save the return code 199 | */ 200 | jc an_error /* carry is set if an error occured */ 201 | xor ax, ax /* zero out ax, return OK if no error */ 202 | } 203 | an_error: 204 | 205 | ASSEMBLE { 206 | mov WORD PTR rc, ax /* save the return code */ 207 | 208 | /* 209 | ; get back old dta 210 | */ 211 | push ds /* save ds */ 212 | mov dx, WORD PTR old_dta /* get OFFSET of old dta */ 213 | mov ax, WORD PTR old_dta+2 /* get SEGMENT of old dta */ 214 | mov ds, ax /* put it in ds */ 215 | mov ah, 0x1a /* DOS set dta */ 216 | int 0x21 /* DOS interrupt */ 217 | pop ds /* get back ds */ 218 | } 219 | if (ceh.flag == ERROR) 220 | rc = ERROR; 221 | return( rc ); 222 | } 223 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/PROMPTS.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/PROMPTS.H -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/TDE.CFG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/TDE.CFG -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/TDE.PRJ: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/TDE.PRJ -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/TDEASM.C: -------------------------------------------------------------------------------- 1 | 2 | #include "tdestr.h" 3 | #include "common.h" 4 | #include "tdefunc.h" 5 | 6 | 7 | /* 8 | * Name: ptoul - pointer to unsigned long 9 | * Purpose: convert a far pointer to unsigned long integer 10 | * Date: June 5, 1991 11 | * Passed: s: a far pointer 12 | * Notes: combine the offset and segment like so: 13 | * offset 0000 14 | * segment + 0000 15 | * ======= 16 | * 00000 17 | * result is returned in dx:ax 18 | */ 19 | unsigned long ptoul( void far *s ) 20 | { 21 | ASSEMBLE { 22 | mov ax, WORD PTR s /* ax = OFFSET of s */ 23 | mov dx, WORD PTR s+2 /* dx = SEGMENT of s */ 24 | mov bx, dx /* put copy of segment in bx */ 25 | mov cl, 12 /* cl = decimal 12 - shift hi word 3 hex digits */ 26 | shr dx, cl /* convert to 'real segment' */ 27 | mov cl, 4 /* cl = 4 - shift hi word 1 hex digit left */ 28 | shl bx, cl /* shift bx - to add 3 digits of seg to 4 of off */ 29 | add ax, bx /* add low part of segment to offset */ 30 | adc dx, 0 /* if carry, bump to next 'real' segment */ 31 | } 32 | } 33 | 34 | 35 | /* 36 | * Name: tabout 37 | * Purpose: Expand tabs in display line 38 | * Date: October 31, 1992 39 | * Passed: s: string pointer 40 | * len: pointer to current length of string 41 | * Notes: Expand tabs in the display line according to current tab. 42 | * If eol display is on, let's display tabs, too. 43 | */ 44 | text_ptr tabout( text_ptr s, int *len ) 45 | { 46 | text_ptr to; 47 | int space; 48 | int col; 49 | int i; 50 | int tab_size; 51 | int show_tab; 52 | int tab_len; 53 | 54 | 55 | tab_size = mode.ptab_size; 56 | show_tab = mode.show_eol; 57 | to = (text_ptr)g_status.tabout_buff; 58 | i = tab_len = *len; 59 | 60 | ASSEMBLE { 61 | push si 62 | push di 63 | push ds 64 | push es 65 | 66 | mov bx, WORD PTR tab_size /* keep tab_size in bx */ 67 | xor cx, cx /* keep col in cx */ 68 | 69 | mov di, WORD PTR to 70 | mov ax, WORD PTR to+2 71 | mov es, ax /* es:di == to or the destination */ 72 | mov si, WORD PTR s 73 | mov ax, WORD PTR s+2 74 | mov ds, ax /* ds:si == s or the source */ 75 | } 76 | top: 77 | 78 | ASSEMBLE { 79 | cmp cx, MAX_LINE_LENGTH /* are at end of tabout buffer? */ 80 | jge get_out 81 | 82 | cmp WORD PTR i, 0 /* are at end of string? */ 83 | jle get_out 84 | 85 | lodsb /* al == BYTE PTR ds:si */ 86 | cmp al, 0x09 /* is this a tab character? */ 87 | je expand_tab 88 | 89 | stosb /* store character in es:di inc di */ 90 | inc cx /* increment col counter */ 91 | dec WORD PTR i /* decrement string counter */ 92 | jmp SHORT top 93 | } 94 | expand_tab: 95 | 96 | ASSEMBLE { 97 | mov ax, cx 98 | xor dx, dx /* set up dx:ax for IDIV */ 99 | IDIV bx /* col % tab_size */ 100 | mov ax, bx /* put tab_size in bx */ 101 | sub ax, dx /* ax = tab_size - (col % tab_size) */ 102 | mov dx, ax /* put ax in dx */ 103 | add cx, ax /* col += space */ 104 | cmp cx, MAX_LINE_LENGTH /* is col > MAX_LINE_LENGTH? */ 105 | jge get_out /* yes, get out */ 106 | mov ax, ' ' /* save blank character in ax */ 107 | cmp WORD PTR show_tab, 0 /* was show_tab flag set? */ 108 | je do_the_tab 109 | mov ax, 0x09 /* put tab character in ax */ 110 | } 111 | do_the_tab: 112 | 113 | ASSEMBLE { 114 | stosb /* store in es:di and incr di */ 115 | dec dx 116 | cmp dx, 0 /* any spaces left to fill? */ 117 | jle end_of_space /* no, get another character */ 118 | add WORD PTR tab_len, dx /* add spaces to string length */ 119 | mov ax, ' ' /* save blank character in ax */ 120 | } 121 | space_fill: 122 | 123 | ASSEMBLE { 124 | cmp dx, 0 /* any spaces left to fill? */ 125 | jle end_of_space /* no, get another character */ 126 | stosb /* store ' ' in es:di and incr di */ 127 | dec dx /* space-- */ 128 | jmp SHORT space_fill /* fill space */ 129 | } 130 | end_of_space: 131 | 132 | ASSEMBLE { 133 | dec WORD PTR i 134 | jmp SHORT top 135 | } 136 | get_out: 137 | 138 | ASSEMBLE { 139 | pop es 140 | pop ds 141 | pop di 142 | pop si 143 | } 144 | if (tab_len > MAX_LINE_LENGTH) 145 | tab_len = MAX_LINE_LENGTH; 146 | *len = g_status.tabout_buff_len = tab_len; 147 | return( (text_ptr)g_status.tabout_buff ); 148 | 149 | /* 150 | tab_size = mode.ptab_size; 151 | show_tab = mode.show_eol; 152 | to = g_status.tabout_buff; 153 | i = tab_len = *len; 154 | for (col=0; col < (MAX_LINE_LENGTH - (tab_size+1)) && i > 0; s++, i--) { 155 | if (*s != '\t') { 156 | *to++ = *s; 157 | ++col; 158 | } else { 159 | space = tab_size - (col % tab_size); 160 | col += space; 161 | space--; 162 | if (space > 0) 163 | tab_len += space; 164 | if (show_tab) 165 | *to++ = '\t'; 166 | else 167 | *to++ = ' '; 168 | for (; space > 0; space--) 169 | *to++ = ' '; 170 | } 171 | } 172 | if (tab_len > MAX_LINE_LENGTH) 173 | tab_len = MAX_LINE_LENGTH; 174 | *len = g_status.tabout_buff_len = tab_len; 175 | return( (text_ptr)g_status.tabout_buff ); 176 | */ 177 | } 178 | -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/WINDOW.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/WINDOW.C -------------------------------------------------------------------------------- /218.功能强大的文本编辑器/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/218.功能强大的文本编辑器/readme.txt -------------------------------------------------------------------------------- /219.图书管理系统/Library.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/219.图书管理系统/Library.c -------------------------------------------------------------------------------- /220.进销存管理系统/SHOP.DAT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RunnerL/C-Game/a9493adbe5ee60d9064debc9afa134784f22eb9d/220.进销存管理系统/SHOP.DAT -------------------------------------------------------------------------------- /220.进销存管理系统/TCTEMP.DAT: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | When you finish learning the grammar of c language,have more practice. 3 | There are 200+ very great problems for you. 4 | Have fun ! 5 | It contains : 6 | * games 7 | * systems 8 | * math 9 | * algorithm 10 | * data structure 11 | * graph 12 | * more~~ 13 | --------------------------------------------------------------------------------