注册 登录
编程论坛 C++教室

我也把刚刚学C++的几个例子拿出来显摆哈

我是RMB帅哥 发布于 2013-01-07 00:22, 393 次点击
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
void main(){
   int list[]={1,4,34,5},b[4];
   copy(a,a+4,ostream_iterator<int >(cout," "));
   cout<<endl;
   
   sort(a,a+4);
   copy(a,a+4,ostream_iterator<int >(cout, " "));
   cout<<endl;

   copy(a,a+4,b);
copy(b,b+4,ostream_iterator<int >(cout," "));
   cout<<endl;

   int *c=find(a,a+4,34);
   if(c=a+4) cout<<"没有这个数"<<endl;
      else   cout<<*c<<endl;
}
3 回复
#2
不玩虚的2013-01-07 08:48
#include<algorithm>
#include<functional>
好神奇,都没有见过
#3
yishixunzhao2013-01-09 10:05
运行了,程序提示错误,没有定义a呀?
#4
peach54602013-01-09 19:20
以下是引用不玩虚的在2013-1-7 08:48:34的发言:

#include
#include
好神奇,都没有见过

STL
1