Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <conio.h>
- #include <string.h>
- using namespace std;
- namespace Umlaut
- {
- const unsigned char AE = static_cast<unsigned char>(142);
- const unsigned char ae = static_cast<unsigned char>(132);
- const unsigned char OE = static_cast<unsigned char>(153);
- const unsigned char oe = static_cast<unsigned char>(148);
- const unsigned char UE = static_cast<unsigned char>(154);
- const unsigned char ue = static_cast<unsigned char>(129);
- const unsigned char ss = static_cast<unsigned char>(225);
- }
- void nochmal();
- void close() //Bei falscher Eingabe schließen
- { system ("CLS");
- cout<<"\n\n\aUNG"<<Umlaut::UE<<"LTIGE EINGABE";
- getch();
- exit(0); }
- float Trigonometrie() //Sinus, Cosinus, Tangens
- {
- string ent;
- system("CLS");
- }
- float Saetze() //Satz des Pythagoras etc.
- {
- system ("CLS");
- cout<<"\n\n- Satz des Pythagoras [1]\n- H"<<Umlaut::oe<<"hensatz [2]\n- Kathetensatz [3]\n\n";
- int ent;
- cin>>ent;
- if (ent==1)
- {
- system("CLS");
- cout<<"\nVorhandene Gr"<<Umlaut::oe<<Umlaut::ss<<"en eingeben \n(Falls Gr"<<Umlaut::oe<<Umlaut::ss<<"e nicht vorhanden, 0 eingeben)";
- cout<<"\n\nHypotenuse: ";
- float Hypotenuse;
- cin>>Hypotenuse;
- cout<<"\nKathete1: ";
- float Kathete1;
- cin>>Kathete1;
- cout<<"\nKathete2: ";
- float Kathete2;
- cin>>Kathete2;
- if (Kathete1!=0 && Kathete2!=0 && Hypotenuse!=0)
- {close();}
- if (Hypotenuse == 0)
- {
- Hypotenuse = sqrt( Kathete1 * Kathete1 + Kathete2 * Kathete2 );
- cout<<"\n\nHypotenuse: "<<Hypotenuse<<"";
- }
- if (Kathete1 == 0)
- {
- Kathete1 = sqrt ( Hypotenuse * Hypotenuse - Kathete2 * Kathete2 );
- cout<<"\n\nKathete1: "<<Kathete1<<"";
- }
- if (Kathete2 == 0)
- {
- Kathete2 = sqrt ( Hypotenuse * Hypotenuse - Kathete1 * Kathete1 );
- cout<<"\n\nKathete2: "<<Kathete2<<"";
- }
- nochmal();
- }
- if (ent==2)
- {
- system("CLS");
- cout<<"\nVorhandene Gr"<<Umlaut::oe<<Umlaut::ss<<"en eingeben \n(Falls Gr"<<Umlaut::oe<<Umlaut::ss<<"e nicht vorhanden, 0 eingeben)\n\n\n";
- cout<<"\n\nH"<<Umlaut::oe<<"he: ";
- float Hoehe;
- cin>>Hoehe;
- cout<<"\nHypotenusenabschnitt p: ";
- float p;
- cin>>p;
- cout<<"\nHypotenusenabschnitt q: ";
- float q;
- cin>>q;
- if (Hoehe==0)
- {
- Hoehe = sqrt( p * q );
- cout<<"\n\nH"<<Umlaut::oe<<"he: "<<Hoehe<<"";
- }
- if (q==0)
- {
- q = ( Hoehe * Hoehe ) / p ;
- cout<<"\n\nHypotenusenabschnitt q: "<<q<<"";
- }
- if (p==0)
- {
- p = ( Hoehe * Hoehe ) / q ;
- cout<<"\n\nHypotenusenabschnitt p: "<<p<<"";
- }
- if (p!=0 && q!=0 && Hoehe!=0)
- {close();}
- nochmal();
- }
- if (ent == 3)
- {}
- }
- int main()
- {
- system ("CLS");
- cout<<"\n\tRechtwinklige Dreiecke";
- cout<<"\n\n- Satz des Pythagoras, H"<<Umlaut::oe<<"hensatz, Kathetensatz [1]\n- Sinus, Cosinus, Tangens [2]\n\n";
- int ent;
- cin>>ent;
- if (ent == 1) // Welche
- {Saetze();} // Funktion
- if (ent == 2) // wird
- {Trigonometrie();} // aufgerufen?
- if (ent!=1 && ent!=2)
- {close();}
- getch();
- return 0;
- }
- void nochmal()
- {
- cout<<"\n\n\n\n\nErneut berechnen? \n\n- Ja [1]\n- Nein [2]\n\n";
- int ent;
- cin>>ent;
- if (ent==1)
- {main();}
- if (ent==2)
- {exit(0);}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement