Cpp pointers

摘要: The pointer can record an address in the main memory of the function.The object name access the memory directly, as the name of the object is relate to some place of the memory, the pointer can store the address of the object. Then with the asterisk '*' you can access the memory with the typ 阅读全文
posted @ 2012-09-21 21:56 很遗憾我不是 阅读(207) 评论(0) 推荐(0) 编辑

srandom and random

摘要: 今天看了看这两个函数的manpage,srandom 的作用是为random 做个种子,默认random生成的数是以srandom(1)为种子的。所以,虽然random 生成的数好像没什么规律,但每次生成的数都是一样的。如果想要改变这个所谓的“随机数”,就要再说srandom生成一个新的种子,比如 srandom(2),不过这样做太麻烦了,先拿srandom(time(0))充个数吧。 #include <stdlib.h> #include <stdio.h> int main() { srandom(time(NULL)); printf(“the number i 阅读全文
posted @ 2012-09-18 11:29 很遗憾我不是 阅读(514) 评论(0) 推荐(0) 编辑

javascript in html

摘要: You place JavaScript within the <head> or <body> section (or both) of an HTML document and you can place multiple scripts on a given page.It's wired to put a program in another language, but as the JavaScript is a language useful, then I have to be known of some thing of it. I will t 阅读全文
posted @ 2012-09-10 00:39 很遗憾我不是 阅读(205) 评论(0) 推荐(0) 编辑

Arguments pass reference or value ? Mutability

摘要: Mutability asks the question of whether an object enables the modification of its value. All Python objects have the following three attributes: type, id, and value.Type and value should hopefully be obvious; the “id” is simply an identification number that uniquely identifies an object from all oth 阅读全文
posted @ 2012-09-08 20:11 很遗憾我不是 阅读(195) 评论(0) 推荐(0) 编辑

class definition in python

摘要: class define in python:class AddressBookEntry(object): version = 0.1 def __init__(self, name, phone): self.name = name self.phone = phone def update_phone(self, phone): self.phone = phonesubclass of the class: class EmployeeAddressBookEntry(AddressBookEntry): def __init__(self, name, phone, id, soci 阅读全文
posted @ 2012-09-08 12:34 很遗憾我不是 阅读(426) 评论(0) 推荐(0) 编辑

sorted: list sort in python

摘要: sorted(...) sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list 阅读全文
posted @ 2012-09-08 12:04 很遗憾我不是 阅读(195) 评论(0) 推荐(0) 编辑

create dict in python

摘要: python, dict, create 阅读全文
posted @ 2012-09-08 11:03 很遗憾我不是 阅读(352) 评论(0) 推荐(0) 编辑

string of Cpp

摘要: The last character of every string is the null character. This character, written \0, is the character with ASCII code 0, and it serves to mark the string’s end. The way to create a string in C++ is like that:char bird[10] = “Mr. Cheeps”;// the \0 is understoodchar fish[] = “Bubbles”; // let the com 阅读全文
posted @ 2012-09-05 00:19 很遗憾我不是 阅读(350) 评论(0) 推荐(0) 编辑

the array.length() of C++

摘要: int num_elements = sizeof things / sizeof (short);this is a use of the function "sizeof", in use of this function we can stop of crossing the border of the array. 阅读全文
posted @ 2012-09-04 23:50 很遗憾我不是 阅读(428) 评论(0) 推荐(0) 编辑

sequence in python

摘要: string, list and tuple are type of the sequence in python, that can be "traverse” or “iterate", and you can get the element of the list use the way of the array in C, like: list[index].This is some functions in the help of the list:| append(...)| L.append(object) -- append object to end| | 阅读全文
posted @ 2012-08-30 11:06 很遗憾我不是 阅读(349) 评论(0) 推荐(0) 编辑