摘要:
bash: g++ a.cpp b.cpp --save-temps -WallDefinition of a classIn C++,separated .h and .cpp files are used to define one class.Class declaration and pr... 阅读全文
摘要:
Object Oriented ProgrammingObjects send and receive messages(objects do things!)Objects send messagesMessages are-Composed by the sender-Interpreted b... 阅读全文
摘要:
What is an object?object=entityobjects=attributes+servicesData: the properties or status < Operations: the functionsMappingFrom the problem space to t... 阅读全文
摘要:
全局变量:1 global.x=5默认参数值: 只有在行参表末尾的哪些参数可以有默认参数值,即def func(a, b=5 )#有效的def func( a=5,b )#无效的关键参数:#!/usr/bin/python# Filename: func_key.pydef func(a, b=5,... 阅读全文
摘要:
if语句:if guess==number: print 'yes'elif guess>number: print 'big'else: print 'small'#python没有switch语句while语句:while running: print 'It is running'el... 阅读全文
摘要:
python标识符命名规则:标识符的第一个字符必须是字母表中的字母(大写或小写)或者一个下划线(‘ _ ’)。标识符名称的其他部分可以由字母(大写或小写)、下划线(‘ _ ’)或数字(0-9)组成。标识符名称是对大小写敏感的。例如,myname和myName不是一个标识符。注意前者中的小写n和后者中... 阅读全文
摘要:
以前上课时一直是用循环来分解一个整数,今天看到递归也可以,挺新鲜的;1 binary_to_ascii( unsigned int value )2 {3 unsigned int quotient;4 quotient=balue/10;5 if( quotient !=0 )6... 阅读全文