爱嘉牛LA

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2012年4月20日

摘要: View Code 1 #include<iostream> 2 #include<string> 3 #include<sstream> 4 using namespace std; 5 int main(){ 6 int x,n,i=0; 7 long sum; 8 string line; 9 cin>>n;10 getline(cin,line);//吸取第一行的尾数结束标志11 while(getline(cin,line)){12 istringstream iss(line);13 sum=0;14... 阅读全文
posted @ 2012-04-20 23:17 爱嘉牛LA 阅读(543) 评论(4) 推荐(0) 编辑

摘要: c++函数库中提供了快速排序函数qsort,它是一种高效的排序算法。qsort函数的形式为:void qsort(void *array,int nelem,int width,int(*fcmp)(const void *,const void *));第一个参数是参与排序的数组的首地址第二个参数是参与排序数组的元素个数第三个参数是单个元素所属数据类型的长度(字节数)第四个参数是指向函数的指针,用于指向用户设计的比较函数举例:一:整型数组的排序比较函数:int comp(const void *a,const void *b){ return *(int *)a-*(int *)b;}... 阅读全文
posted @ 2012-04-20 21:38 爱嘉牛LA 阅读(1775) 评论(4) 推荐(2) 编辑

摘要: #includeusing namespace std;void move(char a,char c){ cout">m; cout<<"The steps to moving"<<m<<"diskes:"<<endl; fun1(m,'A','B','C'); system("pause"); return 0;} 阅读全文
posted @ 2012-04-20 21:35 爱嘉牛LA 阅读(191) 评论(0) 推荐(0) 编辑