Advertisement
thenuke321

MathPad

Oct 26th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.70 KB | None | 0 0
  1. #pragma once
  2. #include <iostream>
  3. #include <cstddef>
  4.  
  5. namespace MathPad20 {
  6.     using namespace std;
  7.     using namespace System;
  8.     using namespace System::ComponentModel;
  9.     using namespace System::Collections;
  10.     using namespace System::Windows::Forms;
  11.     using namespace System::Data;
  12.     using namespace System::Drawing;
  13.  
  14.     /// <summary>
  15.     /// Summary for Form1
  16.     /// </summary>
  17.     public ref class Form1 : public System::Windows::Forms::Form
  18.     {
  19.     public:
  20.         Form1(void)
  21.         {
  22.             InitializeComponent();
  23.             /*
  24.             void setText (char data);
  25.             void clearMath ();
  26.             char mathSet (char ir);
  27.             char setMathBox (char math);
  28.             void mathMode (int mode);
  29.             */
  30.         }
  31.  
  32.     protected:
  33.         /// <summary>
  34.         /// Clean up any resources being used.
  35.         /// </summary>
  36.         ~Form1()
  37.         {
  38.             if (components)
  39.             {
  40.                 delete components;
  41.             }
  42.         }
  43.     private: System::Windows::Forms::TextBox^  mathBox;
  44.     private: System::Windows::Forms::Button^  b1;
  45.     private: System::Windows::Forms::Button^  b2;
  46.     private: System::Windows::Forms::Button^  b3;
  47.     private: System::Windows::Forms::Button^  b4;
  48.     private: System::Windows::Forms::Button^  b5;
  49.     private: System::Windows::Forms::Button^  b6;
  50.     private: System::Windows::Forms::Button^  b7;
  51.     private: System::Windows::Forms::Button^  b8;
  52.     private: System::Windows::Forms::Button^  b9;
  53.     private: System::Windows::Forms::Button^  b0;
  54.  
  55.     private: System::Windows::Forms::Button^  bminus;
  56.  
  57.     private: System::Windows::Forms::Button^  bplus;
  58.     private: System::Windows::Forms::Button^  bdivision;
  59.     private: System::Windows::Forms::Button^  bmulti;
  60.     private: System::Windows::Forms::Button^  equalb;
  61.  
  62.     private: System::Windows::Forms::Button^  button16;
  63.     private: System::Windows::Forms::Button^  button17;
  64.     private: System::Windows::Forms::Button^  button18;
  65.     private: System::Windows::Forms::Button^  button19;
  66.     private: System::Windows::Forms::Button^  button20;
  67.  
  68.  
  69.    
  70.     protected:
  71.  
  72.     protected:
  73.  
  74.     private:
  75.         /// <summary>
  76.         /// Required designer variable.
  77.         /// </summary>
  78.         System::ComponentModel::Container ^components;
  79.        
  80. #pragma region Windows Form Designer generated code
  81.         /// <summary>
  82.         /// Required method for Designer support - do not modify
  83.         /// the contents of this method with the code editor.
  84.         /// </summary>
  85. void InitializeComponent(void)
  86.         {
  87.             System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
  88.             this->mathBox = (gcnew System::Windows::Forms::TextBox());
  89.             this->b1 = (gcnew System::Windows::Forms::Button());
  90.             this->b2 = (gcnew System::Windows::Forms::Button());
  91.             this->b3 = (gcnew System::Windows::Forms::Button());
  92.             this->b4 = (gcnew System::Windows::Forms::Button());
  93.             this->b5 = (gcnew System::Windows::Forms::Button());
  94.             this->b6 = (gcnew System::Windows::Forms::Button());
  95.             this->b7 = (gcnew System::Windows::Forms::Button());
  96.             this->b8 = (gcnew System::Windows::Forms::Button());
  97.             this->b9 = (gcnew System::Windows::Forms::Button());
  98.             this->b0 = (gcnew System::Windows::Forms::Button());
  99.             this->bminus = (gcnew System::Windows::Forms::Button());
  100.             this->bplus = (gcnew System::Windows::Forms::Button());
  101.             this->bdivision = (gcnew System::Windows::Forms::Button());
  102.             this->bmulti = (gcnew System::Windows::Forms::Button());
  103.             this->equalb = (gcnew System::Windows::Forms::Button());
  104.             this->button16 = (gcnew System::Windows::Forms::Button());
  105.             this->button17 = (gcnew System::Windows::Forms::Button());
  106.             this->button18 = (gcnew System::Windows::Forms::Button());
  107.             this->button19 = (gcnew System::Windows::Forms::Button());
  108.             this->button20 = (gcnew System::Windows::Forms::Button());
  109.             this->SuspendLayout();
  110.             //
  111.             // mathBox
  112.             //
  113.             this->mathBox->BorderStyle = System::Windows::Forms::BorderStyle::None;
  114.             this->mathBox->Cursor = System::Windows::Forms::Cursors::Arrow;
  115.             this->mathBox->Font = (gcnew System::Drawing::Font(L"Times New Roman", 48, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  116.                 static_cast<System::Byte>(0)));
  117.             this->mathBox->ForeColor = System::Drawing::Color::SkyBlue;
  118.             this->mathBox->Location = System::Drawing::Point(-1, 0);
  119.             this->mathBox->MaxLength = 90000;
  120.             this->mathBox->Name = L"mathBox";
  121.             this->mathBox->ReadOnly = true;
  122.             this->mathBox->Size = System::Drawing::Size(401, 74);
  123.             this->mathBox->TabIndex = 0;
  124.             this->mathBox->Text = L"0";
  125.             this->mathBox->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
  126.             //
  127.             // b1
  128.             //
  129.             this->b1->Location = System::Drawing::Point(13, 126);
  130.             this->b1->Name = L"b1";
  131.             this->b1->Size = System::Drawing::Size(75, 23);
  132.             this->b1->TabIndex = 1;
  133.             this->b1->Text = L"1";
  134.             this->b1->UseVisualStyleBackColor = true;
  135.             this->b1->Click += gcnew System::EventHandler(this, &Form1::b1_Click);
  136.             //
  137.             // b2
  138.             //
  139.             this->b2->Location = System::Drawing::Point(94, 126);
  140.             this->b2->Name = L"b2";
  141.             this->b2->Size = System::Drawing::Size(75, 23);
  142.             this->b2->TabIndex = 2;
  143.             this->b2->Text = L"2";
  144.             this->b2->UseVisualStyleBackColor = true;
  145.             this->b2->Click += gcnew System::EventHandler(this, &Form1::b2_Click);
  146.             //
  147.             // b3
  148.             //
  149.             this->b3->Location = System::Drawing::Point(229, 126);
  150.             this->b3->Name = L"b3";
  151.             this->b3->Size = System::Drawing::Size(75, 23);
  152.             this->b3->TabIndex = 3;
  153.             this->b3->Text = L"3";
  154.             this->b3->UseVisualStyleBackColor = true;
  155.             //
  156.             // b4
  157.             //
  158.             this->b4->Location = System::Drawing::Point(310, 126);
  159.             this->b4->Name = L"b4";
  160.             this->b4->Size = System::Drawing::Size(75, 23);
  161.             this->b4->TabIndex = 4;
  162.             this->b4->Text = L"4";
  163.             this->b4->UseVisualStyleBackColor = true;
  164.             //
  165.             // b5
  166.             //
  167.             this->b5->Location = System::Drawing::Point(12, 155);
  168.             this->b5->Name = L"b5";
  169.             this->b5->Size = System::Drawing::Size(75, 23);
  170.             this->b5->TabIndex = 5;
  171.             this->b5->Text = L"5";
  172.             this->b5->UseVisualStyleBackColor = true;
  173.             //
  174.             // b6
  175.             //
  176.             this->b6->Location = System::Drawing::Point(93, 155);
  177.             this->b6->Name = L"b6";
  178.             this->b6->Size = System::Drawing::Size(75, 23);
  179.             this->b6->TabIndex = 6;
  180.             this->b6->Text = L"6";
  181.             this->b6->UseVisualStyleBackColor = true;
  182.             //
  183.             // b7
  184.             //
  185.             this->b7->Location = System::Drawing::Point(229, 155);
  186.             this->b7->Name = L"b7";
  187.             this->b7->Size = System::Drawing::Size(75, 23);
  188.             this->b7->TabIndex = 7;
  189.             this->b7->Text = L"7";
  190.             this->b7->UseVisualStyleBackColor = true;
  191.             //
  192.             // b8
  193.             //
  194.             this->b8->Location = System::Drawing::Point(310, 155);
  195.             this->b8->Name = L"b8";
  196.             this->b8->Size = System::Drawing::Size(75, 23);
  197.             this->b8->TabIndex = 8;
  198.             this->b8->Text = L"8";
  199.             this->b8->UseVisualStyleBackColor = true;
  200.             //
  201.             // b9
  202.             //
  203.             this->b9->Location = System::Drawing::Point(13, 184);
  204.             this->b9->Name = L"b9";
  205.             this->b9->Size = System::Drawing::Size(75, 23);
  206.             this->b9->TabIndex = 9;
  207.             this->b9->Text = L"9";
  208.             this->b9->UseVisualStyleBackColor = true;
  209.             //
  210.             // b0
  211.             //
  212.             this->b0->Location = System::Drawing::Point(94, 184);
  213.             this->b0->Name = L"b0";
  214.             this->b0->Size = System::Drawing::Size(75, 23);
  215.             this->b0->TabIndex = 10;
  216.             this->b0->Text = L"0";
  217.             this->b0->UseVisualStyleBackColor = true;
  218.             //
  219.             // bminus
  220.             //
  221.             this->bminus->Location = System::Drawing::Point(229, 184);
  222.             this->bminus->Name = L"bminus";
  223.             this->bminus->Size = System::Drawing::Size(75, 23);
  224.             this->bminus->TabIndex = 11;
  225.             this->bminus->Text = L"-";
  226.             this->bminus->UseVisualStyleBackColor = true;
  227.             //
  228.             // bplus
  229.             //
  230.             this->bplus->Location = System::Drawing::Point(310, 184);
  231.             this->bplus->Name = L"bplus";
  232.             this->bplus->Size = System::Drawing::Size(75, 23);
  233.             this->bplus->TabIndex = 12;
  234.             this->bplus->Text = L"+";
  235.             this->bplus->UseVisualStyleBackColor = true;
  236.             //
  237.             // bdivision
  238.             //
  239.             this->bdivision->Location = System::Drawing::Point(13, 213);
  240.             this->bdivision->Name = L"bdivision";
  241.             this->bdivision->Size = System::Drawing::Size(75, 23);
  242.             this->bdivision->TabIndex = 13;
  243.             this->bdivision->Text = L"รท";
  244.             this->bdivision->UseVisualStyleBackColor = true;
  245.             //
  246.             // bmulti
  247.             //
  248.             this->bmulti->Location = System::Drawing::Point(94, 213);
  249.             this->bmulti->Name = L"bmulti";
  250.             this->bmulti->Size = System::Drawing::Size(75, 23);
  251.             this->bmulti->TabIndex = 14;
  252.             this->bmulti->Text = L"ร—";
  253.             this->bmulti->UseVisualStyleBackColor = true;
  254.             //
  255.             // equalb
  256.             //
  257.             this->equalb->Location = System::Drawing::Point(229, 213);
  258.             this->equalb->Name = L"equalb";
  259.             this->equalb->Size = System::Drawing::Size(75, 23);
  260.             this->equalb->TabIndex = 15;
  261.             this->equalb->Text = L"=";
  262.             this->equalb->UseVisualStyleBackColor = true;
  263.             //
  264.             // button16
  265.             //
  266.             this->button16->Location = System::Drawing::Point(310, 213);
  267.             this->button16->Name = L"button16";
  268.             this->button16->Size = System::Drawing::Size(75, 23);
  269.             this->button16->TabIndex = 16;
  270.             this->button16->Text = L"button16";
  271.             this->button16->UseVisualStyleBackColor = true;
  272.             this->button16->Visible = false;
  273.             //
  274.             // button17
  275.             //
  276.             this->button17->Location = System::Drawing::Point(13, 242);
  277.             this->button17->Name = L"button17";
  278.             this->button17->Size = System::Drawing::Size(75, 23);
  279.             this->button17->TabIndex = 17;
  280.             this->button17->Text = L"button17";
  281.             this->button17->UseVisualStyleBackColor = true;
  282.             this->button17->Visible = false;
  283.             //
  284.             // button18
  285.             //
  286.             this->button18->Location = System::Drawing::Point(94, 242);
  287.             this->button18->Name = L"button18";
  288.             this->button18->Size = System::Drawing::Size(75, 23);
  289.             this->button18->TabIndex = 18;
  290.             this->button18->Text = L"button18";
  291.             this->button18->UseVisualStyleBackColor = true;
  292.             this->button18->Visible = false;
  293.             //
  294.             // button19
  295.             //
  296.             this->button19->Location = System::Drawing::Point(229, 242);
  297.             this->button19->Name = L"button19";
  298.             this->button19->Size = System::Drawing::Size(75, 23);
  299.             this->button19->TabIndex = 19;
  300.             this->button19->Text = L"button19";
  301.             this->button19->UseVisualStyleBackColor = true;
  302.             this->button19->Visible = false;
  303.             //
  304.             // button20
  305.             //
  306.             this->button20->Location = System::Drawing::Point(310, 242);
  307.             this->button20->Name = L"button20";
  308.             this->button20->Size = System::Drawing::Size(75, 23);
  309.             this->button20->TabIndex = 20;
  310.             this->button20->Text = L"button20";
  311.             this->button20->UseVisualStyleBackColor = true;
  312.             this->button20->Visible = false;
  313.             //
  314.             // Form1
  315.             //
  316.             this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  317.             this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  318.             this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"$this.BackgroundImage")));
  319.             this->ClientSize = System::Drawing::Size(397, 338);
  320.             this->Controls->Add(this->button20);
  321.             this->Controls->Add(this->button19);
  322.             this->Controls->Add(this->button18);
  323.             this->Controls->Add(this->button17);
  324.             this->Controls->Add(this->button16);
  325.             this->Controls->Add(this->equalb);
  326.             this->Controls->Add(this->bmulti);
  327.             this->Controls->Add(this->bdivision);
  328.             this->Controls->Add(this->bplus);
  329.             this->Controls->Add(this->bminus);
  330.             this->Controls->Add(this->b0);
  331.             this->Controls->Add(this->b9);
  332.             this->Controls->Add(this->b8);
  333.             this->Controls->Add(this->b7);
  334.             this->Controls->Add(this->b6);
  335.             this->Controls->Add(this->b5);
  336.             this->Controls->Add(this->b4);
  337.             this->Controls->Add(this->b3);
  338.             this->Controls->Add(this->b2);
  339.             this->Controls->Add(this->b1);
  340.             this->Controls->Add(this->mathBox);
  341.             this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
  342.             this->MaximizeBox = false;
  343.             this->Name = L"Form1";
  344.             this->Text = L"11";
  345.             this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
  346.             this->ResumeLayout(false);
  347.             this->PerformLayout();
  348.  
  349.         }
  350. #pragma endregion
  351.     // For some reason VS wants to keep these 2 functions so yeah leave them.
  352.  
  353. void setText (char data)
  354. {
  355.     char *inMath = & data;
  356.     mathBox->Text = Convert::ToString(*inMath);
  357. }
  358. private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
  359.  
  360. }
  361.  
  362.  
  363. private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
  364.         //This is for the GUI so leave it alone and just ignore it.
  365. }
  366.     // Do to the below as you wish.
  367.  
  368. // No need to edit anything below unless you need to.
  369.  
  370.  
  371. // Num 1
  372. private: System::Void b1_Click(System::Object^  sender, System::EventArgs^  e)
  373. {
  374.     char nig = 1;
  375.     setMathBox (nig);
  376. }
  377.  
  378. // Num 2
  379. private: System::Void b2_Click(System::Object^  sender, System::EventArgs^  e)
  380. {
  381.  
  382. }
  383.  
  384. };
  385.  
  386.     // Edit anything below.
  387. /*=======================================================================================*/
  388.  
  389.  
  390. int dmath = 0;
  391. int *stateMath = & dmath;
  392. char *firstMath = new char;
  393. char *secondMath = new char;
  394. char *op = new char;
  395. //*stateMath = 0;
  396.  
  397. void clearMath ()
  398. {
  399.     *stateMath = 0;
  400.     *firstMath = 0;
  401.     *secondMath = 0;
  402.     *op = 0;
  403. }
  404.  
  405. char mathSet (char ir)
  406. {
  407.     char *math = & ir;
  408.     if(*stateMath == 0)
  409.     {
  410.         *firstMath = *math;
  411.     }
  412.     if(*stateMath == 1)
  413.     {
  414.         *secondMath = *math;       
  415.     }
  416.     else{}
  417. //  delete(math);
  418.     ir = NULL;
  419.     return 0;
  420. }
  421.  
  422.  
  423. char setMathBox (char math)
  424. {
  425.  
  426.     char *inMath = & math;
  427.     if(*inMath == 99999999999)
  428.     {
  429.         setText (*inMath);
  430.     }
  431.     else
  432.     {
  433.         // Error hold.
  434.     }
  435. //  delete(*inMath);
  436.     math = NULL;
  437.     return 0;
  438. }
  439.  
  440. void mathMode (int mode)
  441. {
  442. int *state = & mode;
  443.     if(*state == 0)
  444.     {
  445.         *stateMath = 0;
  446.     }
  447.     if(*state == 1)
  448.     {
  449.         *stateMath = 1;
  450.     }
  451.     else
  452.     {
  453.         // Mathmode error.
  454.     }
  455. //  delete(*state);
  456.     mode = NULL;
  457. }
  458.  
  459.  
  460. //char num (){return 0;}
  461.  
  462.  
  463. /*=======================================================================================*/
  464.  
  465.  
  466. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement