12 2017 档案

摘要:#code:utff-8 import sys from functools import reduce # map #允许接受两个参数,第一个为函数,或者为函数表达式,第二个参数为可迭代对象 # 返回list def test(x): return x * 2 t = [1, 2, 3, 4] for tmp in map(test, t): print(tmp) # filt... 阅读全文
posted @ 2017-12-29 11:17 我是外婆 阅读(99) 评论(0) 推荐(0)
摘要:# code:utf-8 #导入 ABCMeta abstractmethodd from abc import ABCMeta, abstractmethod, abstractproperty class Parent(metaclass=ABCMeta): #2.+ 中以次此种方法 #Python 中没有接口的概念 __metaclass__ = ABCMeta ... 阅读全文
posted @ 2017-12-29 10:16 我是外婆 阅读(236) 评论(0) 推荐(0)
摘要://支持七个 构造函数,可迭代,支持索引器设置访问值 BitArray b = new BitArray(8); //初始化八个bit位 最多32位? //看下默认值,默认值为bool型 foreach (bool t in b) { Console.WriteLine(t); //全部为fa... 阅读全文
posted @ 2017-12-15 10:23 我是外婆 阅读(1850) 评论(0) 推荐(0)
摘要:void test(int & val); void test2(const int & val); void test3(int val); struct Person{ string name; int age; int weight; }; int main() { int rats = 10; int & rodents = rats; ... 阅读全文
posted @ 2017-12-12 09:16 我是外婆 阅读(139) 评论(0) 推荐(0)
摘要:char *p; // 不以空字符结尾的只能是字符数组 char str[] = {'a', 'b', 'c', 'd', 'e'}; char str1[] = {'a', 'b', 'c', 'd', 'e', '\0'}; cout << str1 << endl; char str2[] = "sdfsdfsdfwerwetrwerfsd";... 阅读全文
posted @ 2017-12-10 16:03 我是外婆 阅读(102) 评论(0) 推荐(0)
摘要:int *p = new int; cout <<"p` address :" << p << endl; *p = 123; delete p; // int *p2 = 123; int *p1 = {1, 2, 3, 4, 6}; //以上形式是错误的,计算机只会分配指针占用的内存,但是不会初始化 右边数据的内存 //... 阅读全文
posted @ 2017-12-08 11:43 我是外婆 阅读(186) 评论(0) 推荐(0)
摘要:string str = "sdfsdfsd1234fsdf"; cout << str.size() << endl; cout << str.insert(str.size(), "123") << endl; cout << str.find("123") << endl; cout << str.substr(0, 4) << endl; cou... 阅读全文
posted @ 2017-12-08 10:46 我是外婆 阅读(81) 评论(0) 推荐(0)
摘要:char str[] = "123"; // strlen 只计算可见字符, sizeof 则包含'\0' 在内 cout << "strlen : " << strlen(str) << endl; cout << "sizeof :" << sizeof(str) << endl; char name[10]; char name1[10]; ... 阅读全文
posted @ 2017-12-08 09:52 我是外婆 阅读(105) 评论(0) 推荐(0)
摘要:int main() { int* p; //这表明*p 类型为int, 由于*被用于指针,因此p变量本身必须为指针 //我们说p 是指向int类型,可以这样说p 为指针(地址),而*p是int而不是指针 int a[3] = {1, 2, 3}; p = &a[0]; cout arr1(2); //分配在堆 array arr2 = {1,... 阅读全文
posted @ 2017-12-06 16:11 我是外婆 阅读(125) 评论(0) 推荐(0)
摘要:class Program { public static void Main(string[] args) { test t = new test(); test.Test(t); Console.WriteLine(t.Name); Console.Read... 阅读全文
posted @ 2017-12-04 11:07 我是外婆 阅读(230) 评论(0) 推荐(0)