09 2012 档案

摘要:#include <iostream>using namespace std;void main(){ char ch1='a',ch2='b'; //常量指针,强调常量值,一旦指针被赋值,则不能通过指针修改数值(不可改值,但可换成其他变量地址) const char *p1=&ch1; //*p1='p';//出错语句,通过p1改变数值会出错 p1=&ch2;//变数值出错,变地址不出错(应用方向:只读模式,如:可看多个空间,但不可改任何空间内容) cout<<*p1<<endl; //指针常 阅读全文
posted @ 2012-09-24 17:26 LeeKing 阅读(136) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;void main(){ class timetype{ int second,minute,hour; public: timetype(int s=0,int m=0,int h=0){second=s;minute=m;hour=h;} void timeset(int s,int m,int h){second=s;minute=m;hour=h;} void display(){ cout<<"The current time is: "<<hour& 阅读全文
posted @ 2012-09-11 13:50 LeeKing 阅读(516) 评论(0) 推荐(0) 编辑