摘要: http://www.cnblogs.com/uniqueliu/archive/2011/07/16/2108302.htmlhttp://www.cnblogs.com/uniqueliu/archive/2011/07/18/2109301.htmlView Code 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 //第一组为正常的赋值,将指针变量p初始化为0。 7 cout<<"第一组:"<<endl; 8 int i=10; 9 int *p= 阅读全文
posted @ 2012-02-25 01:10 uniquews 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 摘自别人博客通过这种方式,利用类中的公共接口函数,我们就可以访问调用类的私有成员。那么这样做的好处是什么呢?好处就是:提高代码的安全性,防止造成错误的输入与输出。因为在类的公共接口函数中,我们可以对输入的具体值进行限定,那么这样就不会造成数据的错误。比如说下例: 1 class Cat 2 { 3 public: 4 void setWeight(int w) 5 { 6 if(w>0&&w<50)//这里,我们就可以通过一条简单的if语句启动控制作用 7 weight=w; 8 }//设置重量 9 int print(){return... 阅读全文
posted @ 2012-02-25 00:30 uniquews 阅读(219) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/uniqueliu/archive/2011/08/18/2145121.html学习了这篇博主如何在vs2008中显示程序运行时间,很有用啊,不过我原本是想找能在控制台上输出,现就这样吧。View Code 1 #include <iostream> 2 #include <vector> 3 #include <time.h> 4 5 6 using namespace std; 7 using std::vector; 8 9 10 struct ArcBox 11 { 12 int h... 阅读全文
posted @ 2012-02-25 00:19 uniquews 阅读(195) 评论(0) 推荐(0) 编辑