Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <cmath>
- using namespace std;
- void pitagoras(/*double A, double B, double C,*/ double a, double b, double c); /*Skaiciavimu funkcijos paskelbimas*/
- void vaizdas(); /*Trimapio vazido funkcijos paskelbimas*/
- int main()
- {
- setlocale(LC_ALL, "Lithuanian");
- vaizdas(); /*Trimapio vazido funkcijos iskvietimas*/
- double /*A, B, C,*/ a, b, c;
- cout << "Iveskite duomenis (Jeigu duomenu nezinote rasykite 0)" << endl; /*Dialogo pradžia*/
- cout << "Privalote ivesti bent 2 skaicius:" << endl;
- cout << "Krastine a: ";
- cin >> a;
- cout << "Krastine b: ";
- cin >> b;
- cout << "Krastine c: ";
- cin >> c;
- /*cout << "Kampas A: ";
- cin >> A;
- cout << "Kampas B: ";
- cin >> B;
- cout << "Kampas C: ";
- cin >> C; */ /*Dialogo pabaiga*/
- pitagoras(/*A,B,C,*/a,b,c); /*Skaiciavimu funkcijos iskvietimas*/
- }
- void pitagoras(/*double A, double B, double C, */double a, double b, double c) /*Skaiciavimu funckcijos skaiciavimas*/
- {
- if (a != 0 && b != 0)
- {
- c = sqrt((a * a) + (b * b));
- cout << "Izambines c ilgis yra: " << c << endl;
- }
- else if (a != 0 && c != 0)
- {
- b = sqrt ((a * a) - (c * c));
- if (b < 0)
- {
- b = sqrt ((a * a) - (c * c));
- cout << "Statinio b ilgis yra: " << b << endl;
- }
- else
- {
- b = sqrt ((c * c) - (a * a));
- cout << "Statinio b ilgis yra: " << b << endl;
- }
- }
- else
- {
- a = sqrt ((b * b) - (c * c));
- if (a < 0)
- {
- a = (c * c) - (b * b);
- cout << "Statinio a ilgis yra: " << a << endl;
- }
- else
- {
- a = sqrt ((b * b) - (c * c));
- cout << "Statinio a ilgis yra: " << a << endl;
- }
- }
- }
- void vaizdas() /*Trimapio vazido funkcijos vaizdas*/
- {
- cout << " A" << endl;
- cout << " *" << endl;
- cout << " * *" << endl;
- cout << " * * *" << endl;
- cout << "a * * * * c" << endl;
- cout << " * * * * *" << endl;
- cout << " * * * * * *" << endl;
- cout << "C * * * * * * * B" << endl;
- cout << " b " << endl;
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement