摘要: 1 #include 2 #include 3 4 void Meger(int A[],int p,int q,int r)//A为数组,p,q,r分别为下标 5 { 6 int n1 = q-p+1; //前半部分长。 7 int n2 = r-q; //后半部分长。 8... 阅读全文
posted @ 2014-07-11 16:27 _level_ 阅读(263) 评论(0) 推荐(0) 编辑
摘要: typedef unsigned int UINT; //2字节typedef unsigned long DWORD; //4个字节(32伟)1、位图文件头:(14Byte)1 typedef struct tagBITMAPFILEHEADER { /* bmfh */ 2 UINT bf... 阅读全文
posted @ 2014-04-23 21:10 _level_ 阅读(509) 评论(0) 推荐(0) 编辑
摘要: vc++6.0中选择Tools->Options->目录,加入include和lib的路径,这样就可以添加头文件,直接引用包含的库函数。是不是so easy。vc2010中在项目上右键属性,link,添加库和lib 阅读全文
posted @ 2014-04-09 21:29 _level_ 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 在第三课我们抓取了city的代码放在了city.py中;其实第三课的代码运行你会发现一个问题,抓取一段时间后发现程序就会出现异常。根本抓不下来城市的代码。这是因为脚本在短时间内频繁的抓取服务器上的信息会被误认为是攻击,导致服务器禁止了脚本的抓取。如果大家有解决办法,也告诉我一下,一起学习吗。等找到解决方案,我会写下来。下面我们进行第四步吧。在编写一个天气查询脚本我们的任务就完成了: 1 #!/usr/bin/python 2 # -*- coding: gb2312 -*- 3 import urllib2 4 import json 5 from city import city 6 ... 阅读全文
posted @ 2014-04-09 20:32 _level_ 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 首先编写一个python脚本,命名为pytest.py;1 def add(a,b):2 print "in python function add"3 return a+bc调用python示例: 1 #include 2 #include 3 //#include "C:/Python27/include/python.h" 4 //#pragma comment(lib, "C:\\Python27\\libs\\python27.lib") 5 //若在编译器设置了include和lib路径以上两行可以转化为 6 #inclu 阅读全文
posted @ 2014-04-09 08:38 _level_ 阅读(2112) 评论(0) 推荐(0) 编辑
摘要: 第二课的内容学会了吗?如果你看懂了,那么进行第三部吧,其实只是第二步的升级啦……。我们将抓取的城市地区代码储存到本地文件中。比第二课简单多了。看下面代码: 1 import urllib2 2 3 url1 = 'http://m.weather.com.cn/data5/city.xml' 4 content1 = urllib2.urlopen(url1).read(); 5 privences = content1.split(',') 6 result = 'city = {\n' 7 8 url = 'http://m.weat 阅读全文
posted @ 2014-04-08 16:03 _level_ 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 根据第一课学习我们可以编写脚本获取城市代码了(获得的编码格式未转换,要做具体的应用必须转化得到的字符串,或者直接抓取各个省市的代号储存到文件中,这样不需要每次都抓取网页,提高效率)第一步:获取省及直辖市代码:1 import urllib22 3 url1='http://m.weather.com.cn/data5/city.xml'4 content1 = urllib2.urlopen(url1).read()5 provinces = content1.spilt(',')我们可以用print输出content1中的内容:01|北京,02|上海,03|天 阅读全文
posted @ 2014-04-08 15:37 _level_ 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 在E盘下有个aa.py文件。我们可以建立一个脚本:1 import py_compile2 py_compile.compile(r"E:\aa.py")可以将aa.py编译成aa.pyc,放在相同的目录下。 阅读全文
posted @ 2014-04-07 17:34 _level_ 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 十字链表法的创建: 1 typedef struct OLNode 2 { 3 int row,col; 4 int value; 5 struct LONode *right,*down; 6 }OLNode,*OLink; 7 8 typedef struct 9 {10 OLink *row_head,*col_head;11 int m,n,len;12 }CrossList;13 14 void CreatCrossList(CrossList *M)15 {16 int m,n,t;17 scanf("%d,%d,%d",&... 阅读全文
posted @ 2014-04-07 17:16 _level_ 阅读(1238) 评论(0) 推荐(0) 编辑
摘要: 第一步:获取所有省的编号:http://m.weather.com.cn/data5/city.xml查询的字符串格式:"01|北京,02|上海,03|天津",根据查询得到的字符串解析得到城市编号。第二步:根据获得的省的编号获取二级地区编号:http://m.weather.com.cn/data5/city省编号.xml例如:从第一步获得江苏省编号19,则第二步从此处:http://m.weather.com.cn/data5/city19.xml;获取二级编号。例如你想查询南京的天气,找到代码发现代码01.第二步:根据获得的二级地区编号获取三级编号:http://m.w 阅读全文
posted @ 2014-04-06 17:39 _level_ 阅读(194) 评论(0) 推荐(0) 编辑