/*
exception handler
*/
class El;
class E2;
void f() throw(E1, std::bad_exception)
//throws exception of type El or
//bad_exception for any other exception type
{
...
throw El(); //throws exception of type El
...
throw E2(); //calls unexpected(), which throws bad_exception
}
/*
numeric limits
*/
cout << "max(short): " << numeric_limits<short>::max() << endl;
cout << "max(int): " << numeric_limits<int>::max() << endl;
cout << "max(long): " << numeric_limits<long>::max() << endl;
/*
container
*/
/*
algorithm
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void print(int num)
{
cout<<num<<endl;
}
int main()
{
vector<int> list(20);
generate(list.begin(),list.end(),rand);
for_each(list.begin(),list.end(),print);
cout<<" finish . press <<enter>> to exit "<<endl;
cin.get();
}
posted on 2006-07-19 13:14
四海 阅读(164)
评论(0) 编辑 收藏 引用