예제 #1
0
파일: main.c 프로젝트: mzarkowski/c
int main() {
  float aa, bb, xx;

  dane(&aa, &bb);
  // printf("Wczytano aa = %f, bb = %f\n", aa, bb);
  rownanie(aa, bb, &xx);
  // printf("Wyliczono xx = %f\n", xx);
  wynik(aa, bb, xx);
  return 0;
}
예제 #2
0
naboj::naboj(double x, double y, double a, double b,float kat)
{
	this->x = x;
	this->y = y;
	this->a = a;
	this->b = b;
	this->kat = kat;
 
	prosta A = rownanie(x, y, a, b);
	punkt XY = wspPkt(A);
	double a1 = XY.x * 10000;
	double a2 = XY.y * 10000;
	int b1 = a1;
	int b2 = a2;
	a1 = b1 / 10000;
	a2 = b2 / 10000;




	this->stos1 = a1;
	this->stos2 = a2;


	//double przec = 0;
	//double m = (a-x);
	//double n = (b-y);
	//double wartosc = 0;
	//double wartosc2 = 0;
	//przec = sqrt(m*m + n*n);

	////x += 5;
	//if ((x - a) != 0 && (y - b) != 0)
	//{
	//	wartosc = (b - y) / przec;
	//}
	//else
	//{
	//	if ((x - a) == 0)
	//	{
	//		wartosc = 1;
	//	}
	//	else
	//	{
	//		if ((y - b) == 0)
	//		{
	//			wartosc = 0;
	//		}
	//	}

	//}
	////	wartosc = wartosc * 100;
	//if (wartosc < 0)
	//{
	//	wartosc = -wartosc;
	//}


	//wartosc2 = 1 - wartosc;
	//double Ax = 1, Ay = 1;
	//double stos1 = 1, stos2 = 1;
	//stos2 = stos2*wartosc;
	//stos1 = stos1*wartosc2;


	/*this->stos1 = stos1;
	this->stos2 = stos2;*/
	//if ((x - a) != 0 && (y - b) != 0)
	//{
	//	this->stos1 = m/n;
	//	this->stos2 = n/m;
	//}


	//this->stos1 = stos1;
	//this->stos2 = stos2;
	//std::cout << x << " " << y << " " << a << " " << b << std::endl;
			if (a>x && b<y)
			{
				//std::cout << "1" << std::endl;
				this->cw = 1;
			}
			else if (a<x && b<y)
			{
			//	std::cout << "2" << std::endl;
				this->cw = 2;
			}
			else if (a>x && b>y)
			{
			//	std::cout << "4" << std::endl;
				this->cw = 4;
			}
			else if (a<x && b>y)
			{
			//	std::cout << "3" << std::endl;
				this->cw = 3;
			}




}