摘要: #includeusing namespace std;int main(){void swap(char *p1,char *p2);char a[80],b[80],c[80];cin>>a>>b>>c;cout0) swap(a,b);if(strcmp(a,c)>0) swap(a,c);if(strcmp(b,c)>0) swap(b,c);cout<<a<<endl;cout<<b<<endl;cout<<c<<endl;return 0;}void swap(c 阅读全文
posted @ 2012-12-22 11:49 _一千零一夜 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int main(){char *p="ilovechina";cout<<p<<endl;//输出"ilovechina";cout<<*p<<endl;//输出'i';return 0;} 阅读全文
posted @ 2012-12-22 11:45 _一千零一夜 阅读(88) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int main(){int length(char *p);int len;char a[80];cin>>a;cout<<a<<endl;cout<<(a+2)<<endl;//数组名和指针本质竟然差不多;(a+2)想当与另一个数组;len=length(a);cout<<len<<endl;return 0;}int length(char *p){int n;n=0;cout<<*p<<endl;//相当于输出a[0];co 阅读全文
posted @ 2012-12-22 11:42 _一千零一夜 阅读(94) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int main(){int a[8]={0,1,2,3,4,5,6,7};int *p=a;cout<<a<<endl;//输出0012FF60cout<<p<<endl;//输出0012FF60cout<<*(p+1)<<endl;//输出1;cout<<p[2]<<endl;//输出2;return 0;}数组与字符数组和指针的关系略有不同; 阅读全文
posted @ 2012-12-22 11:39 _一千零一夜 阅读(78) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;int main(){char *a="l love C++";while(*a!='\0'){cout<<*a;a++;}cout<<endl;return 0;} 阅读全文
posted @ 2012-12-22 11:36 _一千零一夜 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 大学的日子过的是很快的,同日子一起流失的是我们的智慧和精力斗志,尤其是我们学计算机的大学生,切不可丢失智慧,蹉跎斗志,在这个发展迅速的数字时代我们可以驰骋在世界的巅峰,但我们更容易荒废学业跌倒在无底的深渊,决定我们成功与否的关键不是学会如何在社会中变得灵活不是学会怎样社交甚至不是学会怎样做一个完善的人。作为学计算机的大学生,我们更重要的是放大目光,开阔眼界,养成饥渴的学习态度,把眼光砸到信息的每一个角落。 阅读全文
posted @ 2012-12-18 20:11 _一千零一夜 阅读(125) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;#define p 3.1415926int main(){float r,h,y1,y2,q1,q2,v;cout>r>>h;y1=2*p*r;y2=p*r*r;q1=4*p*r*r;q2=3.0/4.0*p*r*r*r;v=y2*h;cout<<setiosflags(ios::fixed)<<setiosflags(ios::right)<<setprecision(2);cout<<setw(10)<<y1<<endl;c 阅读全文
posted @ 2012-12-18 19:47 _一千零一夜 阅读(94) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;string str1,str2,str3,z;int main(){void exchenge(string *a,string *b);string *a,*b,*c;cin>>str1>>str2>>str3;a=&str1;b=&str2;c=&str3;exchenge(a,b);exchenge(a,c);exchenge(b,c);cout*b){z=*a; *a=*b; *b=z;} 阅读全文
posted @ 2012-12-18 19:44 _一千零一夜 阅读(84) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;int main(){int a,b;int *p1,*p2,*p;cin>>a>>b;p1=&a;p2=&b;if(*p1<*p2){p=p1; p1=p2; p2=p;}cout<<endl;cout<<*p1<<" "<<*p2<<endl;return 0; 阅读全文
posted @ 2012-12-18 19:41 _一千零一夜 阅读(113) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int main(){int i=0,j=0;char a[80],b[40];cin>>a;cin>>b;coutusing namespace std;int main(){int i=0,j=0;char a[80],b[40];cin>>a;cin>>b;cout#includeusing namespace std;int main(){string a,b;cin>>a;cin>>b;a=a+b;cout<<a<<endl;retu 阅读全文
posted @ 2012-12-18 19:39 _一千零一夜 阅读(122) 评论(0) 推荐(0) 编辑