diff --git a/Calculator_Update/calculator.h b/Calculator_Update/calculator.h new file mode 100644 index 0000000000000000000000000000000000000000..1c210db604918aecd4a936bd0317863b6825c032 --- /dev/null +++ b/Calculator_Update/calculator.h @@ -0,0 +1,76 @@ +#ifndef CALCULATOR_H +#define CALCULATOR_H +#include "sinus.h" +#include <iostream> + +#include <QMainWindow> +#include <string> +#include <vector> + +QT_BEGIN_NAMESPACE +namespace Ui { +class Calculator; +} +QT_END_NAMESPACE + +class Calculator : public QMainWindow +{ + Q_OBJECT + +public: + Calculator(QWidget *parent = nullptr); //default + ~Calculator(); //default + //int& index is a reference to an integer and QString& str is a reference to a QString object + //the functions ausdruck, summand, factor, and zahl are all parsing the 'str' string character by character. + //'references' are used in these function parameters to allow multiple functions to operate on the same data + + //QString is a class from the Qt framework which is used for manipulating Unicode strings, + //more efficient and internationalized applications friendly, better as normal std::string + double ausdruck(char& zeichen); //Das eingelesene Zeichen wird immer + double summand(char& zeichen); //per Referenz übergeben, damit es + double factor(char& zeichen); //weitergereicht werden kann, wenn eine + double zahl(char& zeichen); //Funktion es nicht verarbeiten kann. + void check(char& zeichen); + void ausgabe(); + char getZeichen(); + double calcSin(double result, Sinus::Modus defaultModus); + std::string input=""; + +private slots: + void char1(); + void char2(); + void char3(); + void char4(); + void char5(); + void char6(); + void char7(); + void char8(); + void char9(); + void char0(); + void charDiv(); + void charSum(); + void charSub(); + void charFac(); + void charFloat(); + void charKlammerAuf(); + void charKlammerZu(); + void berechne(); + void clearText(); + void onSinButtonClicked(); + void onGradButtonClicked(); + void onRadButtonClicked(); + void onGonButtonClicked(); + void onPiButtonClicked(); + void charKlammerEckig(); + + + +private: + Ui::Calculator *ui; //default + bool isSinus = false; + double pi = 3.14159265; + std::vector <std::string> ausdruecke; + Sinus sinus; +}; + +#endif // CALCULATOR_H