POMÓŻCIE
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;
}
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
4 odpowiedzi w tym temacie
#1
Napisano 21.01.2012 11:09
#2
Napisano 21.01.2012 16:00
to jest miazga dopiero
zapamiętuj wyniki w zmiennych pomocniczych, oszczędzi to dużo czasu i będzie czytelne, np.
To samo musisz zrobić dla reszty kodu.
zapamiętuj wyniki w zmiennych pomocniczych, oszczędzi to dużo czasu i będzie czytelne, np.
double F1 = ((X3-X2)*(Y1-Y2))-((Y3-Y2)*(X1-X2)); cout << "F1:" << F1 << std::endl;
To samo musisz zrobić dla reszty kodu.
#3
Napisano 21.01.2012 16:25
nie zrozumiales mnie ja chce algorytm do tego programu
#4
Napisano 21.01.2012 16:40
schemat blokowy? lista kroków? program w C to też algorytm
#5
Napisano 21.01.2012 16:40
schemat blokowy w c++
Użytkownik Tymbark94 edytował ten post 21.01.2012 16:41
Również z jednym lub większą ilością słów kluczowych: c++
C++
amxx client_putinserver w dllNapisany przez csMaster , 26.07.2020 c++ |
|
|
|||
|
C++
[ROZWIĄZANE] Wyciągnięcie danych z tablicy 2dNapisany przez Alelluja , 06.04.2020 c++ |
|
|
||
C++
Wyświetlanie zdjęcia na pulpicieNapisany przez Booom , 01.10.2019 c++, c++ drawimage |
|
|
|||
C++
FilterKeySetter[Arrow Keys]Napisany przez qrNt , 29.01.2019 c++, c# c++ c |
|
|
|||
C++
Dekompilacja pliku exeNapisany przez RaS_ , 05.02.2016 c++ |
|
|
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych