Скачиваний:
62
Добавлен:
01.05.2014
Размер:
1.53 Кб
Скачать
// 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;

}

Соседние файлы в папке prj1
  • #
    01.05.20142.04 Кб62point.cpp
  • #
    01.05.20141.33 Кб63point.h
  • #
    01.05.20141.53 Кб62prj1.cpp
  • #
    01.05.20144.76 Кб62prj1.dsp
  • #
    01.05.2014533 б63prj1.dsw
  • #
    01.05.201458.37 Кб62prj1.ncb
  • #
    01.05.201449.66 Кб62prj1.opt
  • #
    01.05.20141.93 Кб62prj1.plg