Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Diag {
- public:
- enum Exceptions{OVERINDEXED, NULLPART, DIFFERENT};
- Diag(){ }
- Diag(int k): _v(k, 0) { }
- void reSize(int k) { _v.resize(k, 0); }
- int operator()(int i, int j) const;
- int& operator()(int i, int j);
- friend Diag operator+ (const Diag& a, const Diag& b);
- friend Diag operator* (const Diag& a, const Diag& b);
- friend std::istream& operator>> (std::istream& s, Diag& a);
- friend std::ostream& operator<< (std::ostream& s, const Diag& a);
- private:
- std::vector<int> _v;
- };
- ostream& operator<<(ostream& s, const Diag& a)
- {
- for(unsigned int i=0; i<a._v.size(); ++i){
- for(unsigned int j=0; j<a._v.size(); ++j)
- s << setw(5) << a(i,j);
- s << endl;
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement