JavaScript关于对象的总结
摘要://工厂模式 function creatCar(color,host,size){ var o = new Object(); o.color = color; o.host = host; o.size = size; o.tellColor = function(){alert(o.color);}; return o; } var my...
阅读全文
posted @
2016-03-30 20:04
各种笔记
阅读(207)
推荐(0)
js基础2
摘要:toFixed() returns a string, with the number written with a specified number of decimals:var x = 9.656;x.toFixed(0); // returns 10x.toFixed(2); // retu
阅读全文
posted @
2016-03-28 18:14
各种笔记
阅读(198)
推荐(0)
JavaScript笔记(基础)
摘要:1. JavaScript can "display" data in different ways: Writing into an alert box, using window.alert().Writing into the HTML output using document.write(
阅读全文
posted @
2016-03-26 18:22
各种笔记
阅读(186)
推荐(0)
杨辉三角
摘要:#include "stdafx.h" #include #include using namespace std; class Lab1 { private: vector> whole; public: Lab1(int n) { vector tmpVec; tmpVec.push_back(1); whole.pus...
阅读全文
posted @
2016-03-26 13:56
各种笔记
阅读(436)
推荐(0)
Mem, MyString
摘要:MemB.h的代码: MemB.cpp的代码: MyString的代码和main函数: strcpy遇到的不安全问题可以通过这个来解决: http://jingyan.baidu.com/article/ce436649fd61543773afd32e.html 1. char *strcpy(ch
阅读全文
posted @
2016-03-24 22:16
各种笔记
阅读(281)
推荐(0)
nested friend
摘要:#include "stdafx.h" #include #include using namespace std; const int sz=20; struct Holder{ private: int a[sz]; public: void initialize(); struct Pointer; friend Pointer; struc...
阅读全文
posted @
2016-03-24 14:20
各种笔记
阅读(216)
推荐(0)
????friend关键字
摘要:#include "stdafx.h" #include using namespace std; //A里面有个private的变量,需要被其他的如 //全局函数g(A *a)、h()、结构体C、结构体中的某个函数B::f(A *a)访问 struct A; struct B{ void f(A *a); //这里用到了A,那么前面必须前面有A的声明 }; st...
阅读全文
posted @
2016-03-24 13:35
各种笔记
阅读(237)
推荐(0)
关于stack
摘要:下面是MyStack.h的代码: 下面是MyStack.cpp的内容: 下面是main函数的代码:
阅读全文
posted @
2016-03-24 10:12
各种笔记
阅读(470)
推荐(0)
结构体的大小
摘要:#include "stdafx.h" #include using namespace std; struct A{ int i[100]; }; struct B{ void f(); }; void B::f(){ } struct C{ }; int _tmain(int argc, _TCHAR* argv[]) { cout<<size...
阅读全文
posted @
2016-03-24 08:38
各种笔记
阅读(195)
推荐(0)
CStash
摘要:#include "stdafx.h" #include #include #include using namespace std; const int increment=100; typedef struct { int size; //每个元素所需空间 int quantity; //存储空间总数量 int next; //下一个空的空...
阅读全文
posted @
2016-03-23 20:17
各种笔记
阅读(539)
推荐(0)