Preview only show first 10 pages with watermark. For full document please download

Geometria Computacional - Testeponto 2d

classes de geometria computacional

   EMBED


Share

Transcript

"#include ""Ponto_2D.h int main(){ cout << endl<< ""==================================================================="" << endl; cout << "" ------------ TESTES PONTO -----------------""<< endl; cout << ""==================================================================="" << endl<> x1_;///< ler um numero inteiro cout << ""Digite um numero Racional da seguinte maneira: 2/3 : "" ; cin >> x_;///< ler um numero Racional cout << ""Digite dois, da seguinte maneira: (1/3,2/1) (2/4,3/5) : "" << endl; cout << ""P["" << 1 <<""]= "" ; cin >> P1 ;///< ler um ponto cout << ""P["" << 2 <<""]= "" ; cin >> P2 ;///< ler um ponto cout << endl<<""=== SOMA PONTO COM PONTO=== "" << endl; P3 = P1 + P2; ///< Soma dois pontos cout << ""P3= "" << P3 << endl << endl; cout << ""=== SUBTRACAO PONTO COM PONTO=== "" << endl; P3 = P1 - P2;///< Subtrai dois pontos cout << ""P3= "" << P3 << endl << endl; cout << ""=== PRODUTO PONTO COM RACIONAL === "" << endl; P3 = P2*x_; cout << ""P3= P2*x_ = "" << P3 << endl; P3 = P1*x_;///< Multiplica um ponto por um numero inteiro cout << ""P3= P1*x_ = "" << P3 << endl << endl; cout << ""=== PRODUTO RACIONAL COM PONTO === "" << endl; P3 = x_ * P2;///< Multiplica um numero Racional por um ponto cout << ""P3= x_*P2 = "" << P3 << endl; P3 = x_ * P1;///< Multiplica um numero inteiro por um ponto cout << ""P3= x_*P1 = "" << P3 << endl << endl; cout << ""=== PRODUTO PONTO COM INTEIRO === "" << endl; P3 = P2*x1_; cout << ""P3= P2*x1_ = "" << P3 << endl; P3 = P1*x1_; cout << ""P3= P1*x1_ = "" << P3 << endl << endl; cout << ""=== PRODUTO INTEIRO COM PONTO === "" << endl; P3 = x1_ * P2; cout << ""P3= x1_*P2 ="" << P3 << endl; P3 = x1_ * P1; cout << ""P3= x1_*P1 = "" << P3 << endl << endl; P1==P2? cout << P1 << "" eh igual a "" << P2 << endl : cout << P1 << "" NAO eh igual a "" << P2 << endl ; P1==P3? cout << P1 << "" eh igual a "" << P3 << endl : cout << P1 << "" NAO eh igual a "" << P3 << endl ; P2==P3? cout << P2 << "" eh igual a "" << P3 << endl << endl : cout << P2 << "" NAO eh igual a "" << P3 << endl << endl ; P1!=P2? cout << P1 << "" eh diferente de "" << P2 << endl : cout << P1 << "" eh igual a "" << P2 << endl ; P1!=P3? cout << P1 << "" eh diferente de "" << P3 << endl : cout << P1 << "" eh igual a "" << P3 << endl ; P2!=P3? cout << P2 << "" eh diferente de "" << P3 << endl << endl : cout << P2 << "" eh igual a "" << P3 << endl << endl ; /// Testando funcoes da classe Ponto_2D cout << ""=== DISTANCIA === "" << endl; Rac _rac1; float _rac; _rac= P1.Distancia(P2); cout << "" Distancia= "" << _rac << endl << endl; cout << ""=== DISTANCIA AO QUADRADO === "" << endl; _rac1= P1.Distancia_ao_quadrado(P2); cout << "" Distancia_ao_quadrado= "" << _rac1 << endl << endl; return 0; } "