Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Student {
- private:
- string ime;
- int br_na_index;
- float prosek;
- public:
- Student() {
- }
- Student(string _ime, int _br_na_index, float _prosek) {
- ime = _ime;
- br_na_index = _br_na_index;
- prosek = _prosek;
- }
- Student(const Student & tmp) {
- ime = tmp.ime;
- br_na_index = tmp.br_na_index;
- prosek = tmp.prosek;
- }
- ~Student() {
- }
- string get_ime() {
- return ime;
- }
- int get_br_na_index() {
- return br_na_index;
- }
- float get_prosek() {
- return prosek;
- }
- void set_ime(string _ime) {
- ime = _ime;
- }
- void set_br_na_index(int _br_na_index) {
- br_na_index = _br_na_index;
- }
- void set_prosek(float _prosek) {
- prosek = _prosek;
- }
- };
- class Point {
- private:
- int x, y;
- public:
- Point() {}
- Point(int _x, int _y) {
- x = _x;
- y = _y;
- }
- Point(const Point & tmp) {
- x = tmp.x;
- y = tmp.y;
- }
- ~Point() {}
- Point operator + (Point tmp) {
- Point res(x + tmp.x, y + tmp.y);
- return res;
- }
- Point operator - (Point tmp) {
- Point res(x - tmp.x, y - tmp.y);
- return res;
- }
- Point operator * (Point tmp) {
- Point res(x * tmp.x, y * tmp.y);
- return res;
- }
- Point operator / (Point tmp) {
- Point res(x / tmp.x, y / tmp.y);
- return res;
- }
- Point & operator = (Point tmp) {
- x = tmp.x;
- y = tmp.y;
- return *this;
- }
- Point & operator += (Point tmp) {
- x += tmp.x;
- y += tmp.y;
- return *this;
- }
- Point & operator -= (Point tmp) {
- x -= tmp.x;
- y -= tmp.y;
- return *this;
- }
- Point & operator *= (Point tmp) {
- x *= tmp.x;
- y *= tmp.y;
- return *this;
- }
- Point & operator /= (Point tmp) {
- x /= tmp.x;
- y /= tmp.y;
- return *this;
- }
- void print() {
- cout << x << " " << y << endl;
- }
- };
- int main()
- {
- Point a(1, 2);
- Point b(3, 4);
- a /= b;
- a.print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement