Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Vettore.h"
- #include <iomanip>
- Vettore::Vettore()
- {
- m_x = m_y = m_z = 0;
- }
- Vettore::Vettore(double x, double y, double z)
- {
- m_x = x;
- m_y = y;
- m_z = z;
- }
- Vettore Vettore::operator+(const Vettore& v)
- {
- return Vettore( m_x + v.m_x, m_y + v.m_y, m_z + v.m_z);
- }
- std::ostream& operator<<(std::ostream& o, Vettore& v)
- {
- o.setf(std::ios::showpos);
- o << std::scientific;
- o << std::setprecision(4);
- o << "("
- << std::setw(10) << v.x() << ", "
- << std::setw(10) << v.y() << ", "
- << std::setw(10) << v.z() << ")";
- o << "|" << v.modulo() << "|";
- return o;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement