#include #include #include #include #include #include "vector-t.h" /* Teste da Class Vector com template */ void f( void ) throw(VectorAlocError, VectorRangeError) { Vector v(10); for(int i=0; i<10; ++i) v[i]=i*10; printf("\n"); for(i=0; i<10; ++i) cout<< "-> " << v[i]; printf("\n"); getchar(); } void g( void ) throw(VectorAlocError, VectorRangeError) { Vector v(10); for(int i=0; i<10; ++i) v[i]=i*10.5; printf("\n"); for(i=0; i<=10; ++i) { cout << setw(7)<< "-> " << setprecision(2) << v[i]; } printf("\n"); getchar(); } main() { try { f(); g(); } catch( VectorAlocError& v ) { cout<< "\n-> Nao conseguiu alocar " << v.get() << " Bytes !!!"; getchar(); } catch( VectorRangeError& v ) { cout<< "\n-> Erro na referencia " << v.get() << " do Vetor !!!"; getchar(); } catch( ... ) { cout<< "\n-> Erro Desconhecido "; getchar(); unexpected(); } }