Witam :) Mam ogromny porblem, który muszę jeszcze dziś rozwiązać ;/ Chodzi o to, że mam zadanie na laborki:

//Przygotuj klasę Figura, która będzie klasą abstrakcyjną
posiadającą następujące składniki:
· dane składowe protected:
nazwa (string),
P1(współrzędne x1, y1),
P2(współrzędne x2, y2),
P3(współrzędne x3, y3),
P4 (współrzędne x4, y4),
kolor
· publiczną funkcję składową: przedstaw_się (wypisuje nazwę figura),
· wirtualne funkcje składowe Obwód o Pole
· odpowiednie konstruktor
Klasa Figura jest klasą podstawową dla klas: Kwadrat, Prostokąt, Romb, Czworokąt.
Zdefiniuj każdą z klas pochodnych dodając niezbędne dane składowe opisujące daną
figurę (np. promień, itd.). W każdym przypadku zdefiniuj odpowiednio funkcje Obwód oraz
Pole. Każda z klas musi mieć zdefiniowany swój konstruktor otrzymujący parametry
inicjalizujące figurę.
Przygotuj funkcję PokazFigure, której argumentem jest wskaźnik na obiekt typu
Figura. Funkcja powinna wywoływać funkcję składową Przedstaw_sie oraz
dodatkowo wypisywać informację o polu oraz obwodzie figury.
W programie głównym stwórz obiekty typu Kwadrat, Prostokąt, Romb, Czworokąt. Wywołaj
funkcję PokazFigure przekazując do niej wskaźnik do utworzonych obiektów.
Zmodyfikuj program tak, aby rysował figury na ekranie (środowisko MFC).
Napisz program tak aby była możliwość zmiany położenia wierzchołków. Program powinien
sam określić czy dana figura jest prostokątem, rombem, kwadratem czy innym dowolnym
czworokątem.//

Zrobiłem juz trochę, ale utknąłem w miejscu ;/ Przy kompilacji wywala mi błędy w pliku Figura.cpp
'Figura' is not a clas or namespace name wywala go przy każdym użyciu Figura::

PLIK Figura.h

 #pragma once
#include "iostream"
using namespace std;
#include "stdafx.h"

class Figura
{
protected:
	string nazwa;
	string kolor;
public:
	Figura(int=1, int=1, int=1, int=1, int=1, int=1, int=1, int=1);
	POINT P1, P2, P3, P4;
	virtual ~Figura(void){};
	virtual string Przedstaw_Sie();
	virtual double Obwod() =0;
	virtual double Pole() =0;
	double Odcinek(POINT, POINT);
	
};

PLIK Figura.cpp

#include "Figura.h"
#include "stdafx.h"
#include "Math.h"


string Figura::Przedstaw_Sie()
{
	return nazwa;
}


Figura::Figura(int x1, int x2, int x3, int x4, int y1, int y2, int y3, int y4)
{
	P1.x = x1; P1.y = y1;
	P2.x = x2; P2.y = y2;
	P3.x = x3; P3.y = y3;
	P4.x = x4; P4.y = y4;

}


double Figura::Odcinek(POINT P1, POINT P2)
{
	double dl_odcinka=0;
	dl_odcinka=sqrt(pow((double)(P2.x-P1.x),2) + ((double(P2.y-P1.y),2)));
		return dl_odcinka;

}
 

Macie już te dwa pliki. Kolejnym moim problemem jest "POINT" niestety nie mam pojeciana czym to polega ;/ wiem, ze to typedef, bo w pliku ...Dlg.cpp jest deklarowane... A więc mając instrukcję czy moglibyście wytłumaczyć mi na czym polegają moje błędy? Jak mam zamiast tego POINT zadeklarować punkty P1,P2... oraz wspolrzedne x1,y1...?;> I następnie jak uzyć ich w pliku ...Dlg zamiast tego POINT. Zapomniałbym dodać, że tam wyżej w plkiu Figura.cpp również nie działa to wsyztsko od POINT'a jak współrzędne itd... a oto kod błędu:

 error C2065: P1 is undeclared identifier
error C2228 left of '.y' must have class/struct/union

Myślę, że tyle wsytarczy :P

a oto pliki kolejne:

__PLIK JCeladyn_196047_Lab9Dlg.cpp __

 
// JCeladyn_196047_Lab9Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "JCeladyn_196047_Lab9.h"
#include "JCeladyn_196047_Lab9Dlg.h"
#include "afxdialogex.h"
#include "Kwadrat.h"
#include "Prostokat.h"
#include "Romb.h"
#include "Czworokat.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CAboutDlg dialog used for App About

class CAboutDlg : public CDialogEx
{
public:
	CAboutDlg();

// Dialog Data
	enum { IDD = IDD_ABOUTBOX };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation
protected:
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()


// CJCeladyn_196047_Lab9Dlg dialog




CJCeladyn_196047_Lab9Dlg::CJCeladyn_196047_Lab9Dlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(CJCeladyn_196047_Lab9Dlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	x1 = 0;
	y1 = 0;
	x2 = 0;
	y2 = 0;
	x3 = 0;
	y3 = 0;
	x4 = 0;
	y4 = 0;
	m_nazwa = _T("");
	m_pole = 0.0;
	m_obwod = 0.0;
}

void CJCeladyn_196047_Lab9Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, x1);
	DDX_Text(pDX, IDC_EDIT2, y1);
	DDX_Text(pDX, IDC_EDIT3, x2);
	DDX_Text(pDX, IDC_EDIT4, y2);
	DDX_Text(pDX, IDC_EDIT5, x3);
	DDX_Text(pDX, IDC_EDIT6, y3);
	DDX_Text(pDX, IDC_EDIT7, x4);
	DDX_Text(pDX, IDC_EDIT8, y4);
	//  DDX_Control(pDX, IDC_EDIT9, m_zadanie);
	DDX_Text(pDX, IDC_EDIT9, m_nazwa);
	DDX_Text(pDX, IDC_EDIT10, m_pole);
	DDX_Text(pDX, IDC_EDIT11, m_obwod);
}

BEGIN_MESSAGE_MAP(CJCeladyn_196047_Lab9Dlg, CDialogEx)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_EN_CHANGE(IDC_EDIT1, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit1)
	ON_EN_CHANGE(IDC_EDIT2, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit2)
	ON_EN_CHANGE(IDC_EDIT3, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit3)
	ON_EN_CHANGE(IDC_EDIT4, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit4)
	ON_EN_CHANGE(IDC_EDIT5, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit5)
	ON_EN_CHANGE(IDC_EDIT6, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit6)
	ON_EN_CHANGE(IDC_EDIT7, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit7)
	ON_EN_CHANGE(IDC_EDIT8, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit8)
	ON_EN_CHANGE(IDC_EDIT9, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit9)
	ON_EN_CHANGE(IDC_EDIT10, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit10)
	ON_EN_CHANGE(IDC_EDIT11, &CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit11)
	ON_BN_CLICKED(IDOK, &CJCeladyn_196047_Lab9Dlg::OnBnClickedOk)
	ON_BN_CLICKED(IDC_BUTTON1, &CJCeladyn_196047_Lab9Dlg::OnBnClickedButton1)
END_MESSAGE_MAP()


// CJCeladyn_196047_Lab9Dlg message handlers

BOOL CJCeladyn_196047_Lab9Dlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		BOOL bNameValid;
		CString strAboutMenu;
		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
		ASSERT(bNameValid);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here

	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CJCeladyn_196047_Lab9Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialogEx::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CJCeladyn_196047_Lab9Dlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialogEx::OnPaint();
	}
}

// The system calls this function to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CJCeladyn_196047_Lab9Dlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}



void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit1()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit2()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit3()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit4()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit5()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit6()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit7()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit8()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit9()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit10()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnEnChangeEdit11()
{
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialogEx::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}


void CJCeladyn_196047_Lab9Dlg::OnBnClickedOk()
{
	// TODO: Add your control notification handler code here
	UpdateData();
	Figura* fig = &(Sprawdz());
	PokazFigure(fig);


}

void CJCeladyn_196047_Lab9Dlg::PokazFigure(Figura* figurka)
{
	CDC* dc = GetDC();
	POINT tab[4] = { figurka->P1, figurka->P2, figurka->P3, figurka->P4};
	int minx=tab[0].x, miny=tab[0].y;
	for(int i=1; i<4;i++)
	{
		if(tab[i].x < minx) minx = tab[i].x;
		if(tab[i].y < miny) miny = tab[i].y;		
	}	
	for(int i=0; i<4;i++)
	{
		tab[i].x = tab[i].x - minx + 25;
		tab[i].y = tab[i].y - miny + 50;
	}	

	dc->Polygon(tab, 4);
	m_pole = figurka -> Pole();
	m_obwod = figurka -> Obwod();
	m_nazwa = figurka -> Przedstaw_Sie().c_str();
	UpdateData(FALSE);
	this ->ReleaseDC(dc);
}

Figura& CJCeladyn_196047_Lab9Dlg::Sprawdz()//rozpoznawanie figury
{
	Figura* wsk;
	double dlugosc1=sqrt(pow((double)(x1-x2),2)+pow((double)(y1-y2), 2));
	double dlugosc2=sqrt(pow((double)(x3-x2),2)+pow((double)(y3-y2), 2));
	double dlugosc3=sqrt(pow((double)(x3-x4),2)+pow((double)(y3-y4), 2));
	double dlugosc4=sqrt(pow((double)(x1-x4),2)+pow((double)(y1-y4), 2));
	int skalar = (x2-x1)*(x4-x1) + (y2-y1)*(y4-y1);
	if( (dlugosc1==dlugosc2) && (dlugosc2==dlugosc3) && (dlugosc3==dlugosc4) )
	if(skalar==0)
		wsk = new Kwadrat(x1,y1,x2,y2,x3,y3,x4,y4);
	else
		wsk = new Romb(x1,y1,x2,y2,x3,y3,x4,y4);
	else if( (dlugosc1==dlugosc3) && (dlugosc2==dlugosc4) && (skalar==0))
		wsk = new Prostokat(x1,y1,x2,y2,x3,y3,x4,y4);
	else
		wsk = new Czworokat(x1,y1,x2,y2,x3,y3,x4,y4);
	return *wsk;
}





void CJCeladyn_196047_Lab9Dlg::OnBnClickedButton1()
{

	CRect obszar;
	GetClientRect(obszar);
	InvalidateRect(&obszar);
	// TODO: Add your control notification handler code here
}

Myślę, że z rozszerzeniem .h nie będzie potrzebny Wam moi drodzy... Klasami typou Romb czy Kwadrat nie będę już spamował... Jeżeli jakieś pytania to śmiało... Byłbym Baaaaardzo wdzięczny jeżeli ktoś do wieczora pomógłby mi z tym zadaniem :)

Aha i jeszcze jedno ;P jak ustawić obszar rysowania?;> tak aby w jednym (ustalonym) rogu program rysował zadane figury, żeby przypadkiem nie nachodziły na tekst :)