C玩耍
文章平均质量分 60
心明在线
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
2014年05月11日
练习1-13 水平直方图 #include #define OUT 1 #define IN 0 main() { int c,i,j,nc=0; int ndigit[10]; int state=OUT; for(i=0;i ndigit[i]=0; while((c=getchar())!=EOF) { if(c==' '||c=='\t'||c=='\n')原创 2014-08-13 15:04:02 · 377 阅读 · 0 评论 -
结构体+typedef的具体应用和解释
首先需要先了解结构体的基本知识: 1.结构体定义: struct 结构体名 { ……结构体成员; } 举例:struct student { char name[10]; int age; }2.结构指针-struct *p 其中,p为指向结构的一个指针,在给p传地址时,要给他传入结构体类型的地址。 举例:struct student *p; st原创 2015-05-18 19:32:05 · 978 阅读 · 0 评论 -
详谈指针*/**,引用&
【指针*与&】指针和数组有异曲同工之妙,在前面博客有专门解释过,指针声明用*,凡是在声明一个变量前面加上这个符号,就是说明声明的这个变量是一个指针,它是一个地址,比如:int a = 2; int *p; p = &a;p就是一个指向整型变量的指针,p指向的是整型变量a的地址,而*在使用的时候还有一个别名,解引用,抵消了&引用功能,&在这里是引用a的地址。*p = 1;//其实*p = *(&a)原创 2015-05-20 11:05:23 · 669 阅读 · 0 评论 -
Operation on character string to delete same alphabet
#include #include char a[]={'a','b','a','c','a','c','d','e','k','b'}; typedef char key_type; typedef struct node{ key_type key; struct node *next; }node, *pnode; void insert(pnode *root, key_type k原创 2015-01-06 11:17:21 · 793 阅读 · 0 评论 -
Output result string after numbers addition and subtraction
通过键盘输入100以内正整数的加、减运算式,请编写一个程序输出运算结果字符串。 输入字符串的格式为:“操作数1 运算符 操作数2”,“操作数”与“运算符”之间以一个空格隔开原创 2015-01-07 20:29:04 · 636 阅读 · 0 评论 -
The operation on charactor string to compress the same alphabets
一个字符串压缩程序,将字符串中连续出席的重复字母进行压缩,并输出压缩后的字符串原创 2015-01-07 17:54:22 · 730 阅读 · 0 评论 -
typedef和结构体的定义之间的道道
typedef struct struct_1 struct_1_t; struct struct_1 { int i;原创 2014-10-29 21:23:17 · 447 阅读 · 0 评论 -
2014年05月19日
practice 3-6: write a funtion itoa(n,s,width) that could receive the width ,which is the legal least charactor width.if s[] 's width under the limits,make some blank in it to the limits. #include void原创 2014-08-13 15:04:33 · 724 阅读 · 0 评论 -
2014年05月15日
practice 3-1:Our binary search makes two tests inside the loop,when one would suffice (at the price of more tests outside).Write a version with only one test inside the loop and measure the difference原创 2014-08-13 15:04:24 · 368 阅读 · 0 评论 -
2014年05月14日
practice 2-4:restart compile function squeeze(s1,s2),delete any match characters between string s1 and s2.#include #define MAXLINE 1000 void squeeze(char s1[],char s2[]); void show(char s[]); main() {原创 2014-08-13 15:04:16 · 415 阅读 · 0 评论 -
2014年05月13日
practice 2-3:turn hexadecimal into decade #include #define MAXLINE 100 int ten_digit(char s[]); int power(int m,int n); int change(char c); main() { char a[MAXLINE]; int result; gets(a); result=原创 2014-08-13 15:04:14 · 385 阅读 · 0 评论 -
2014年05月19日
practice 4-1: #include #define MAXLINE 1000 int getline(char line[],int max); int strindex(char source[],char searchfor[]); char pattern[]="ould"; main() { char line[MAXLINE]; int found=0; while(ge原创 2014-08-13 15:04:35 · 402 阅读 · 0 评论 -
2014年05月15日
practice 3-2:Write a function escape(s,t),copy string t to string s,and display some invisable charactor like '\n' '\t' and so on,make them visable,with switch sentence grammer.Then write another func原创 2014-08-13 15:04:26 · 353 阅读 · 0 评论 -
2014年05月13日
practice 1-18:delete blank or'\t' at the end of one line of words,also before the \n #include #define MAXWORD 1000 int getline(char line[],int maxline); int removes(char s[]); int main() { char line[原创 2014-08-13 15:04:12 · 381 阅读 · 0 评论 -
顺序表1
一天一小步,不能颓了 #include #include #define MAXSIZE 1000 typedef struct { int data[MAXSIZE]; int last;//记录当前线性表中最后一个元素在数组中的位置,表长last+1 }Seqlist; //顺序表初始化 Seqlist *init_Seqlist() { Seqlist *L=malloc(sizeof原创 2014-08-13 15:04:50 · 665 阅读 · 0 评论 -
2014年05月21日
实现库函数strncpy,strncat,strncmp char *liw_strncpy(char *s, const char *ct, size_t n) { char *p; p = s; for (; n > 0 && *ct != '\0'; --n) *p++ = *ct++; for (; n > 0; --n) *p++ = '\0'; return原创 2014-08-13 15:04:44 · 298 阅读 · 0 评论 -
2014年05月21日
practice 5-3: rewrite strcat(s,t) used pointer,copy string t to the end of string s #include void strcat1(char *s,char *t); void strcpy1(char *s,char *t); main() { char s1[100]="hello"; char s2[]="x原创 2014-08-13 15:04:39 · 355 阅读 · 0 评论 -
2014年05月20日
practice 4-12: #include void printd(int n) { if(n { putchar('-'); n=-n; } if(n/10) printd(n/10); putchar(n+'0'); return; } main() { int num=123; printd(num); return 0; } practice 4-13:原创 2014-08-13 15:04:37 · 518 阅读 · 0 评论 -
2014年05月19日
practice 3-5: Write a function itob(n,s,b),that converts the integer n into a base b character representation in the string s.In particular,itob(n,s,16) formats n as a hexadecimal integer in s. #inclu原创 2014-08-13 15:04:31 · 399 阅读 · 0 评论 -
2014年05月15日
practice 2-7:编写汉书invert(x,p,n)将x从第p位开始的n位求反,其余不变 #include unsigned invert(unsigned x,int p,int n) { return x^(~(~0 } main() { unsigned num,result; int m,n; scanf("%d,%d,%d",&num,&m,&n); result=i原创 2014-08-13 15:04:21 · 394 阅读 · 0 评论 -
2014年06月04日
//统计关键字的个数#include #include #include #define MAXWORD 100 //关键字最大的个数 struct key{ char *word; int count; }keytab[]={ {"auto",0}, {"break",0}, {"case",0}, {"char",0}, {"const",0}, {"continue",0},原创 2014-08-13 15:04:46 · 422 阅读 · 0 评论 -
2014年05月16日
practice 3-3: Write a function expand(s1,s2) which expand the shorthand notation like a-z among the input string s1 into a complete list form a to z like abc...xyz.Allow for letters of either case and原创 2014-08-13 15:04:28 · 340 阅读 · 0 评论 -
2014年05月13日
practice 1-16:print any length dialogue #include #define MAXLINE 1000 int getline(char line[],int maxline); //void copy(char to[],char from[]); main() { int len,i ; int max; char line[MAXLINE]; //原创 2014-08-13 15:04:10 · 365 阅读 · 0 评论 -
单链表
#include #include struct student{ char *name; char *num; int weight; int high; struct student *right; }; struct student *create(char *na,char *nu,int w,int h); void push_pre(struct student **p,st原创 2014-08-13 15:04:48 · 404 阅读 · 0 评论 -
2014年05月21日
practice 5-4:write a function strend(s,t),return 1 if string t show in the end of string s,or return 0 #include #include int strend(char *s,char *t) { int length1,length2; length1=strlen(s); length原创 2014-08-13 15:04:42 · 327 阅读 · 0 评论 -
2014年05月14日
practice 2-6:将x中从第p位开始的n个(二进制)位设置为y中最右边n位的值,x的其余各位保持不变 #include unsigned setbits(unsigned x,int p,int n,unsigned y) { unsigned tmp; tmp=(~0 x=x&tmp; y=(y return x|y; } main() { int num1,num2,m,n原创 2014-08-13 15:04:19 · 365 阅读 · 0 评论
分享