Napiszcie mi algorytm do tego programu:
na zdjeciu "fota" podaje przypadkowe liczby po pyknieciu enter oblicza mi wszystkie obliczenia tak jak widac na "fota2"
Oto moj program troche po amatorsku zrobiony
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <conio.h>
const float PI = 3.14159265;
using namespace std;
int main(void)
{
double Promien, X1, Y1, X2, Y2, X3, Y3;
double sin( double alfa); // sinus
double cos( double alfa); // cosinus
double tan( double alfa); // tangens
cout << "Obliczanie metody tyczenia trasy";
cout << endl << endl;
cout << "================================" << endl;
cout << "Podaj Promien:"; cin >> Promien;
cout << "Podaj X1:"; cin >> X1;
cout << "Podaj Y1:"; cin >> Y1;
cout << "Podaj X2:"; cin >> X2;
cout << "Podaj Y2:"; cin >> Y2;
cout << "Podaj X3:"; cin >> X3;
cout << "Podaj Y3:"; cin >> Y3;
cout << endl;
cout << "================================" << endl;
std::cout << "X3-2:" << X3-X2 << std::endl;
std::cout << "Y3-2:" << Y3-Y2 << std::endl;
std::cout << "X1-2:" << X1-X2 << std::endl;
std::cout << "Y1-2:" << Y1-Y2 << std::endl;
cout << "================================" << endl;
std::cout << "F1:" << ((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)) << std::endl;
std::cout << "F2:" << ((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2)) << std::endl;
std::cout << "F0:" << (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) << std:: endl;
std::cout << "Tan-1(F0):" << atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI << std:: endl;
cout << "================================" << endl;
std::cout << "T1:" << Promien * tan(((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/4)*PI/200) << std::endl;
std::cout << "T:" << Promien * tan(((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/2)*PI/200) << std::endl;
std::cout << "Ys:" << (2 * Promien) * sin(((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/4)*PI/200) * sin(((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/4)*PI/200) << std::endl;
std::cout << "Xs:" << Promien * sin(((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/2)*PI/200) << std::endl;
std::cout << "L:" << 2* PI * Promien * (200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/400 << std::endl;
std::cout << "2Fi:" << (200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10 << std::endl;
std::cout << "Fi:" << ((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2 << std::endl;
cout << "================================" << endl;
std::cout << "Alfa:" << 200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI<< std::endl;
std::cout << "Alfa/2:" << (200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/2 << std::endl;
std::cout << "Alfa/4:" << (200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/4 << std::endl;
cout << "================================" << endl;
std::cout << "C1:" << sin(( 1 * ((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2) * PI/200) *( 2 * Promien) << std::endl;
std::cout << "C2:" << sin(( 2 * ((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2) * PI/200) *( 2 * Promien) << std::endl;
std::cout << "C3:" << sin(( 3 * ((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2) * PI/200) *( 2 * Promien) << std::endl;
std::cout << "C4:" << sin(( 4 * ((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2) * PI/200) *( 2 * Promien) << std::endl;
std::cout << "C5:" << sin(( 5 * ((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2) * PI/200) *( 2 * Promien) << std::endl;
cout << "================================" << endl;
std::cout << "LAMBDA 1:" << (((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2)*1 << std::endl;
std::cout << "LAMBDA 2:" << (((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2)*2 << std::endl;
std::cout << "LAMBDA 3:" << (((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2)*3 << std::endl;
std::cout << "LAMBDA 4:" << (((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2)*4 << std::endl;
std::cout << "LAMBDA 5:" << (((200-atan( (((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)))/(((X3-X2)*(X1-X2))+((Y3-Y2)*(Y1-Y2))) ) * 200 / PI)/10)/2)*5 << std::endl;
getch();
return 0;
}


Dodatki SourceMod




Moja zawartość
Mężczyzna