123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //
- // Created by jovian on 15/01/18.
- //
- #include <iostream>
- #include "PointSystem.h"
- PointSystem::PointSystem() : nb(0) {}
- void PointSystem::addPoint(int p) {
- if (nb >= MAX_SIZE)
- return;
- points[nb] = p;
- nb ++;
- }
- void PointSystem::display() {
- std::cout << "Welcome in my system !!!" << std::endl;
- std::cout << nb << " points." << std::endl;
- for (int i(0); i < nb; i++)
- std::cout << i << " : " << points[i] << std::endl;
- }
- std::ostream &operator<<(std::ostream &os, const PointSystem &pointSystem) {
- os << pointSystem.nb << std::endl;
- for (int i(0); i < pointSystem.nb; i++)
- os << pointSystem.points[i] << std::endl;
- return os;
- }
- std::istream &operator>>(std::istream &is, PointSystem &pointSystem) {
- is >> pointSystem.nb;
- for (int i(0); i < pointSystem.nb; i++)
- is >> pointSystem.points[i];
- return is;
- }
|