木其网络科技专业程序员代写http://www.xmsydw.com
程序员学历擅长经验网店链接
apenny硕士ASP.NET PHP 电子 通信设计 图像 编程 网络5年进入店铺
zheng_qianqian本科C语言 C++面向对象 Java3年进入店铺
guoguanl本科Java Web项目 JSP Hibernate Struts Mysql4年进入店铺
摘要: Richard M. Stallman大神是谁就不用说了,一时来了兴趣,想看看Linux系统下有多少程序有这位大神参与编写的。先把所有命令导出到文件中,遍历所有命令,用man手册查一下并过滤Stallman关键词。以下是脚本#!/bin/bash i=0; touch Stallman ls /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games > command for line in `cat command` do man $line | grep Richard\ M.\ Stallman 阅读全文
posted @ 2013-07-21 21:48 C语言程序 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 对数组进行操作,查找、插入、删除。#include #include #include int size = 0; int flag = 0; void output(int *arry) { int i = 0; for(i=0; i=0 && pospos; i--) { arry[i] = arry[i-1]; } arry[pos] = num; } else //在最后的位置插入 { arry[size] = num; } size++; } else printf("只能在0-%d的位置插入。\n",... 阅读全文
posted @ 2013-07-21 21:25 C语言程序 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 随机产生一些字符,然后输入要查找的字符,本想将查找到的字符存储起来,要么初始化一个等大小的数组,要么要先检索出总共查找到多少个元素,再开辟空间存储,但这样相当于搜索了两遍,没有想到更好的方法,只是简单的将找到的字符打印出来。#include #include #include #define SIZE 100 int getstr(char *str, int max) { int i; srand(time(NULL)); for(i=0; i<max-1; i++) { if(rand()%2) str[i] = rand() % 26 + 'A'; //产生在... 阅读全文
posted @ 2013-07-21 21:20 C语言程序 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 输入要显示的杨辉三角的行数,会打印出金字塔型的杨辉三角,不过行数太多的话,效果不太好,可以再调整一下格式控制。#include #include int main() { int i,j,k; int line; int *prev, *next; printf("输入要查看杨辉三角的行数(大于2):"); scanf("%d",&line); if(line =i; j--) //外部空格 { printf(" "); } printf("%6d",1); for(k=2; k<i; k++) // 阅读全文
posted @ 2013-07-21 21:13 C语言程序 阅读(604) 评论(0) 推荐(0) 编辑
摘要: 输入两个日期,计算之间相差多少天。 用了两种方法实现,第二种利用结构体,代码比较清晰,其余的都一样。1.普通的写法#include int leapyear(int year) { if((year%4==0 && year%100!=0) || year%400==0) return 1; else return 0; } int days(int *day1, int *day2) { int i=0; int *tmp; int diff = 0; const int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,... 阅读全文
posted @ 2013-07-21 21:09 C语言程序 阅读(1277) 评论(0) 推荐(0) 编辑
摘要: 输入一个日期,判断下一个日期是哪一天,如果日期输入错误,则调用Linux下的cal命令显示输入的月份。#include #include #include #include int year, month, day; const int day_30 = 30; const int day_31 = 31; int day_month_2 = 0; char err_flag = 0; void compute() { printf("输入年月日(1992-7-19):"); scanf("%d-%d-%d",&year, &month, 阅读全文
posted @ 2013-07-21 21:01 C语言程序 阅读(615) 评论(0) 推荐(0) 编辑
摘要: 最近回炉重造C语言,陆续写一些比较短的代码,选择其中的一些贴到这里,都是在Linux下的代码,Windows未测试。第一个判断三角形的类型,两个浮点型数据不能直接判断相等,为了输入方便一些,自己设置的精度比较低,10^(-3)。#include #include #define EPSINON 1e-3 #define ABS(a) (((a)>0)?(a):(-a)) //?:不支持表达式嵌套 #define ZERO(x) ((x)>-EPSINON && (x)(b))?(a):(b)) #define MIN(a,b) (((a)0) || !(b>0 阅读全文
posted @ 2013-07-21 20:57 C语言程序 阅读(1043) 评论(0) 推荐(0) 编辑
木其网络科技专业程序员代写http://www.xmsydw.com
程序员学历擅长经验网店链接
apenny硕士ASP.NET PHP 电子 通信设计 图像 编程 网络5年进入店铺
zheng_qianqian本科C语言 C++面向对象 Java3年进入店铺
guoguanl本科Java Web项目 JSP Hibernate Struts Mysql4年进入店铺