Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania bez odpowiedzi
Viewing all articles
Browse latest Browse all 21942

Visual Studio C++

$
0
0

Witam.
Swój kod piszę w Visual Studio w języku C++ CLR. Mam problem z utowrzeniem obiektu klasy, którą sam napisałem. Nie wiem dlaczego ale nie program nie chce się skąpliować. Problem pojawia się wtedy kiedy chce utoworzyć nowy obiekt klasy.

private: System::Void button_akcja_Click(System::Object^  sender, System::EventArgs^  e) {

	Punkt p1;
	p1.x1 = Convert::ToDouble(txt_wsp_X1->Text);
	p1.y1 = Convert::ToDouble(txt_wsp_Y1->Text);
	p1.x2 = Convert::ToDouble(txt_wsp_X2->Text);
	p1.y2 = Convert::ToDouble(txt_wsp_Y2->Text);

	lbl_AB->Visible = true;
}

class Punkt {
public:
	double x1, y1;
	double x2, y2;

	double odleglosc(double xa, double ya, double xb, double yb) {
		if (xa == xb) {
			double a = ya - yb;
			return Math::Abs(a);
		}
		if (ya == yb) {
			double a = xa - xb;
			return Math::Abs(a);
		}
		else {
			double a = Math::Pow(Math::Abs(xa - xb), 2) + Math::Pow(Math::Abs(ya - yb), 2);
			return Math::Sqrt(a);
		}
	}
};

 


Viewing all articles
Browse latest Browse all 21942