1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#include <iostream>
#include <cmath>
using namespace std;
double LaipRad(double laip); //laip = degrees
double RadLaip(double rad);
double krastine(double a, double b, double gama); //krastine = side
double kampas(double a, double b, double beta);// kampas = angle
void LaipMinSek(double alfa); //deg min sek
int main()
{
setlocale(LC_ALL, "Lithuanian");
double laip;
cout<<"Įvesk kampą 'gamma'\n";
cin>>laip; //function requires 'laip' so I guess I need to do it ?
laip;
LaipRad(laip);
return 0;
}
double LaipRad(double laip){
double a, b, gamma, pi;
pi=3,14;
gamma=laip*pi/180;
cout<<"Įvesk a ir b kraštinių ilgius centimetrais\n";
cin>>a>>b;
krastine(a, b, gamma);
return 0;
}
double krastine(double a, double b, double gamma){
double beta;
beta=gamma;
a=sqrt(a*a+b*b-2*b*a-gamma);
kampas(a, b, beta);
return 0;
}
double kampas(double a, double b, double beta){
double gamma, rad, alfa;
gamma=beta;
beta=beta*b/a; //proportion, sin theory maybe
rad=beta;
alfa=180-gamma-RadLaip(rad);
LaipMinSek(alfa);
return 0;
}
double RadLaip(double rad){
double pi, alfa, beta;
pi=3,14;
beta=rad*180/pi;
return beta;
}
void LaipMinSek(double alfa){ // I guess this is not working too
double min, sek;
int laip;
laip=alfa;
min=int(alfa-laip)*60;
sek=(alfa-laip-min/60)*3600;
cout<<"Alfa kampas: \n"<<laip<<"° "<<min<<":"<<sek;
}
|