Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Курсовая по ООП2 / prj1 / prj1
.cpp// prj1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
#include "point.h"
#include "trajectory.h"
int main(int argc, char* argv[])
{
Point p(2, 5); // Конструктор с двумя параметрами
cout << "p = ";
p.write();
// Демонстрируем операцию инкремента
// постфиксная
p++;
cout << "p++ = ";
p.write();;
cout << endl;
// префиксная
++p;
cout << "++p = ";
p.write();
cout << endl;
Point * p1 = new Point(3);
cout << "*p1";
p1->write();
cout << endl;
// Демонстрируем операцию декримента
// префиксная
cout << "--*p1 = ";
(--*p1).write();
cout << endl;
// постфиксная
;
cout << "(*p1)-- = ";
((*p1)--).write();
cout << endl;
cout << "*p1";
p1->write();
cout << endl;
// Вычитаем точки
Point p3 = p - *p1;
cout << "p3 = p - *p1 = ";
p3.write();
cout << "\n";
// Складываем точки
Point p4 = p + *p1;
cout << "p4 = p + *p1 = ";
p4.write();
cout << endl;
Point p2;
cout << "enter Point p2 coordinates: "; // Так как консоль использует кодировку OEM866, а
// в Windows используется кодировка CP1255,
// на экран выводим на английском
p2.read(); // Координаты вводятся через пробел
cout << "p2 = ";
p2.write();
cout << endl;
cout << "p2.radius() = " << p2.radius() << ", p2.angle() = " << p2.angle() << endl;
// Демонстрируем работу с Траекторией
Trajectory j(1, 2, 3, 4);
j.draw();
cout << endl;
getchar();
return 0;
}