摘要: from Tkinter import *def foo(): input = var.get() try: c = eval(input) except: c = "error!" t.config(text = "结果是: " + str(c))root = Tk()root.title("小小计算器")#btnbutton = Button(root, text="计算结果", command = foo)button.grid(column=2, row=1, sticky=E)#inputvar = St 阅读全文
posted @ 2014-02-11 18:04 WINSTON-DEAN 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1 import random 2 import glob 3 import xml.etree.ElementTree as ET 4 5 def IdFactory(startNumber, taskTotal, expectNumberList , outputArrayLength, ouputArrayNumber ): 6 for outputNumber in range(ouputArrayNumber): 7 outputArray = [] 8 for outputLength in range(outputArrayLength... 阅读全文
posted @ 2013-04-20 00:00 WINSTON-DEAN 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1 int a[10]={1,2,3,4,5,6,7,8,9,10};2 int *ptr = (int *)(&a+1);3 int *ptr2 = (int *)(a+1);4 5 cout<<*(a+1)<<endl;6 cout<<*(ptr-1)<<endl;7 cout<<*(ptr2)<<endl;对于这段代码输出是:2102对于a+1,这没有什么让人疑惑的地方,就是指向数组下一个元素,这里是int型,对于32位环境,就是内存地址+4.让人困惑的是 &a+1 。这结果地址到底增长多少呢?再插入 阅读全文
posted @ 2013-03-24 01:27 WINSTON-DEAN 阅读(568) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 3 #include <stack> 4 5 using namespace std; 6 int factorial(int num); 7 int factorialByStack(int num); 8 9 main()10 {11 int n = 10;12 int result1;13 int result2;14 result1 = factorialByStack(n);15 result2 = factorial(n);16 cout<<result1<<"--------- 阅读全文
posted @ 2013-03-21 02:16 WINSTON-DEAN 阅读(526) 评论(0) 推荐(0) 编辑
摘要: class----------------------------------------------------------[prefix] classNmae <dataType>(if it's a template class) =<dataType>( alias of a bound datatype template)prefix: utility,abstractbeside---(if this class is a template class but still not bind any datatype, you can draw a d 阅读全文
posted @ 2013-03-16 00:03 WINSTON-DEAN 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 用C的思想来写的二叉排序树。在QtCreate+win7上编译通过头文件View Code 1 #ifndef BSTree_H 2 #define BSTree_H 3 //BSTree.h 4 #define SUC 1 5 #define UNSUC 0 6 7 #include <stdlib.h> 8 #include <cstdio> 9 typedef int KeyType;10 //还有另一种结构,带指向父节点的指针,编写方法时更简单,但存储耗费更大11 struct BSTNode{12 struct BSTNode* Lchild;13 struc 阅读全文
posted @ 2013-03-15 15:33 WINSTON-DEAN 阅读(205) 评论(0) 推荐(0) 编辑