neu initialisiert

This commit is contained in:
Leaced 2017-04-08 18:03:33 +02:00
parent ef8bdb0399
commit 3f69c5223a
4 changed files with 7 additions and 97 deletions

View file

@ -1,92 +0,0 @@
#include<iostream>
#include<string>
#include<sstream>
#include<math.h>
class Point
{
public:
double X, Y;
void setX(double x)
{
X = x;
}
void setY(double y)
{
Y = y;
}
Point(double x = 0, double y = 0)
{
X = x;
Y = y;
}
void print()
{
std::cout << "(" << X << "," << Y << ")";
}
};
class Line
{
public:
Point P, Q;
double b, m;
void setPoint(bool p, Point point)
{
if(p==0)
{
Q.setX(point.X);
Q.setY(point.Y);
}
else
{
P.setX(point.X);
P.setY(point.Y);
}
}
void distance()
{
std::cout << sqrt((P.X-Q.X)*(P.X-Q.X)+(P.Y-Q.Y)*(P.Y-Q.Y));
}
void gradient()
{
m = (P.Y-Q.Y)/(P.X-Q.X);
}
void nullPointX()
{
b = (-P.X)*(P.Y-Q.Y)/(P.X-Q.X)+(P.Y);
std::cout << b;
}
void nullPointY()
{
std::cout << (P.X)*(P.Y-Q.Y)/(P.X-Q.X)/((P.Y-Q.Y)/(P.X-Q.X));
}
void print()
{
gradient();
std::cout << m <<"*x + ";
nullPointX();
}
};
int main()
{
Point P(3,5), Q(5,3);
Line g;
g.setPoint(0, Q);
g.setPoint(1, P);
g.print();
getchar();
}

View file

@ -2,6 +2,7 @@
#include<sstream>
#include<string>
#include<math.h>
#include<conio.h>
#define PI 3.14159
@ -150,6 +151,6 @@ int main()
std::cout << "\nbeta: " << beta/PI << " pi " << beta*180/PI << "\xF8";
std::cout << "\ngamma: " << gamma/PI << " pi " << gamma*180/PI << "\xF8";
getchar();
getch();
return(0);
}

View file

@ -10,7 +10,7 @@
int main()
{
std::string input;
unsigned int amount;
unsigned int amount = 0;
std::cout << "Gib an bis zu welcher Zahl nach befreundeten Zahlen gesucht werden soll: ";
getline(std::cin, input);

View file

@ -1,11 +1,12 @@
#include<iostream>
#include<string>
#include<sstream>
#include<conio.h>
int main()
{
std::string input;
unsigned long long max;
unsigned long long max = 1;
std::cout << "Gib an bis zu welcher Zahl nach befreundeten Zahlen gesucht werden soll: ";
@ -15,7 +16,7 @@ int main()
if(max<284)
{
std::cout << "\nEs wurden keine befreundeten Zahlen gefunden.";
getchar();
getch();
return(0);
}
@ -31,6 +32,6 @@ int main()
if(sum2==number) std::cout << sum << " und " << sum2 << "\n";
}
getchar();
getch();
return(0);
}