书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!

2012年4月26日

回车呀回车

摘要: 在输入的过程中,我们经常用回车来将数据分成不同的部分。那么,我们应该怎么来识别回车呢?这里有一个十分牛B的处理方法:那就是用gets(str)。为什么用gets呢?因为它能够读入回车,像scanf呀,cin呀都是不可以读入回车的。那么怎么来判断gets读入的是不是回车呢?这里有一个牛B的处理方法:那就是用strcmp(str, "")==0;为什么呢是将str和“”来比较呢。因为只有一个回车独占一行的话,这是的str是空的。好了,说了这么多,还是来总结一下吧。while(gets(str), strcmp(str, "")!=0){ ……;}用上面的这个 阅读全文

posted @ 2012-04-26 21:15 More study needed. 阅读(198) 评论(0) 推荐(0) 编辑

简单字典树练习

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1251这个相当简单就不解释了。直接上代码。View Code #include "iostream"#include "cstdio"#include "cstring"#include "string"using namespace std;typedef struct node{ int Cross; struct node *next[26];}node;node *head;void InitHead(){ head 阅读全文

posted @ 2012-04-26 20:48 More study needed. 阅读(160) 评论(0) 推荐(0) 编辑

链表的典型应用——字典树

摘要: 题目:http://acm.swust.edu.cn/oj/problem/842/这个题目是有一点复杂的,因为在存储内容的时候又再次用了链表。可以说它是链表题目的相当典型的例子了。还是直接上代码吧。View Code #include "iostream"#include "cstring"#include "string"#include "cstdio"#include "algorithm"#include "malloc.h"using namespace std; 阅读全文

posted @ 2012-04-26 20:08 More study needed. 阅读(260) 评论(0) 推荐(0) 编辑

导航

书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!