摘要: 字符串的函数2012-02-12 15:59:20标签:字符串添加标签>>函数名: strcat功 能: 字符串拼接函数用 法: char *strcat(char *destin, char *source);程序例:#include <string.h>#include <stdio.h>int main(void){ char destination[25]; char *blank = " ", *c = "C++", *Borland = "Borland"; strcpy(destina 阅读全文
posted @ 2012-02-22 23:45 某某。 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 杭电1002 A+Bproblem。。。交了七遍,最后发现原来有五遍是因为没删测试输出= =、、2012-02-19 09:34:23标签:字符串水题添加标签>>A + B Problem IITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 98985Accepted Submission(s): 18771Problem DescriptionI have a very simple problem for you. Given 阅读全文
posted @ 2012-02-22 23:42 某某。 阅读(399) 评论(0) 推荐(0) 编辑
摘要: /* 做这道题之前我用了一上午头的时间都没有明白怎么变成后缀式,但是一旦知道后缀式怎么变成表达式的时候思路就很清晰了(感谢秦川同学,尚灿芳同学//scanf= =...,赵鹏同学对小的不离不弃不厌倦= =。。。); 转换成后缀式无非就是遵循保证优先级高或者是相等时候入栈的的先打出来(此题中即先出栈打印),遇到()时先把括号里的输出在输出括号外面的; */ #include<stdio.h> #include<stdlib.h> struct stack { char c[100]; int top; }; int Push ( struct stac... 阅读全文
posted @ 2012-02-22 23:36 某某。 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 struct Lnode/*以为当时做的题目没有告诉我是多少位的数字所以我选择了长度不受限的链栈*/ 5 { 6 int num; 7 struct Lnode *next; 8 }; 9 10 int Push(struct Lnode *top , int x)//压入数据 11 { 12 struct Lnode *p = (struct Lnode*)malloc(sizeof(struct Lnode)); 13 p->nu... 阅读全文
posted @ 2012-02-22 23:35 某某。 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 struct node 4 { 5 int num; 6 struct node *next; 7 }; 8 int n,k; 9 struct node * input(int n) 10 { 11 int i; 12 struct node *head,*tail,*p; 13 14 p = (struct node *)malloc(sizeof(struct node)); 15 p->next = NULL... 阅读全文
posted @ 2012-02-22 23:33 某某。 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 3函数名称: malloc 函数原型: void * malloc(unsigned size); 函数功能: 分配size字节的存储区 函数返回: 所分配的内存区地址,如果内存不够,返回0 4函数名称: realloc//内存数据清零 函数原型: void * realloc(void * p,unsigned size); 函数功能: 将p所指出的已分配内存区的大小改为size,size可以比原来分配的空间大或小 函数返回: 返回指向该内存区的指针.NULL-分配失败 1函数名称: calloc 函数原型: void * calloc(unsigned n,unsigned... 阅读全文
posted @ 2012-02-22 23:32 某某。 阅读(1606) 评论(0) 推荐(0) 编辑
摘要: /*发现写长代码的时候写分成小部分去实现很有必要,容易差错*/#include<stdio.h> #include<stdlib.h> struct node { int num; struct node* next; }; struct node * input(int n) { int i; struct node *head,*tail,*p; head = tail = (struct node *)malloc(sizeof(struct node)); head->next = NULL; for... 阅读全文
posted @ 2012-02-22 23:31 某某。 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 1 /*这题的错误是和同学熬夜找出来的呃= =。。。*/ 2 3 #include<stdio.h> 4 #include<string.h> 5 int main() 6 { 7 int front,rear,i,f,j,n,t,q[10000]; 8 char s[20]; 9 scanf("%d",&n); 10 rear =0,front=0; 11 for(i=0;i<n;i++) 12 { 13 rear=i; 14 sca... 阅读全文
posted @ 2012-02-22 23:30 某某。 阅读(156) 评论(0) 推荐(0) 编辑
摘要: /*其实完全不用建立结构体,但是由于刚学栈的结构体形式所以才用一下,希望王旭老师多多指教*/ #include<stdio.h> #include<stdlib.h> struct stack { int c[100]; int top; }; int Push ( struct stack *p,int n) { if( p->top == 49 ) return 0; else { p->top++; p->c[p->top] =n; return 1; ... 阅读全文
posted @ 2012-02-22 23:29 某某。 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int i,k,l1,l2,ii,j,leap; 6 char s1[1001],s2[1001]; 7 while(gets(s1)!=NULL) 8 { 9 gets(s2); 10 l1=strlen(s1); 11 l2 = strlen(s2); 12 leap =0; 13 14 ... 阅读全文
posted @ 2012-02-22 23:27 某某。 阅读(398) 评论(0) 推荐(0) 编辑