diff --git a/.vs/Calculator/FileContentIndex/2c7c8519-6b3d-4ae9-88d5-8b0b83cac4f6.vsidx b/.vs/Calculator/FileContentIndex/2c7c8519-6b3d-4ae9-88d5-8b0b83cac4f6.vsidx deleted file mode 100644 index 0054a78..0000000 Binary files a/.vs/Calculator/FileContentIndex/2c7c8519-6b3d-4ae9-88d5-8b0b83cac4f6.vsidx and /dev/null differ diff --git a/.vs/Calculator/FileContentIndex/af5f8b4c-dae8-4d06-bda9-3fccd29da0b9.vsidx b/.vs/Calculator/FileContentIndex/af5f8b4c-dae8-4d06-bda9-3fccd29da0b9.vsidx new file mode 100644 index 0000000..70aef67 Binary files /dev/null and b/.vs/Calculator/FileContentIndex/af5f8b4c-dae8-4d06-bda9-3fccd29da0b9.vsidx differ diff --git a/.vs/Calculator/FileContentIndex/cb8bfddb-f135-4cbe-96b1-1fbe740c53ef.vsidx b/.vs/Calculator/FileContentIndex/cb8bfddb-f135-4cbe-96b1-1fbe740c53ef.vsidx new file mode 100644 index 0000000..70aef67 Binary files /dev/null and b/.vs/Calculator/FileContentIndex/cb8bfddb-f135-4cbe-96b1-1fbe740c53ef.vsidx differ diff --git a/.vs/Calculator/FileContentIndex/ccf0027b-8332-4daa-99a9-207552781745.vsidx b/.vs/Calculator/FileContentIndex/ccf0027b-8332-4daa-99a9-207552781745.vsidx deleted file mode 100644 index 40e3784..0000000 Binary files a/.vs/Calculator/FileContentIndex/ccf0027b-8332-4daa-99a9-207552781745.vsidx and /dev/null differ diff --git a/.vs/Calculator/FileContentIndex/e4e53563-4b6a-4c94-96a4-64cee82fe258.vsidx b/.vs/Calculator/FileContentIndex/e4e53563-4b6a-4c94-96a4-64cee82fe258.vsidx new file mode 100644 index 0000000..19b9a50 Binary files /dev/null and b/.vs/Calculator/FileContentIndex/e4e53563-4b6a-4c94-96a4-64cee82fe258.vsidx differ diff --git a/.vs/Calculator/v17/.suo b/.vs/Calculator/v17/.suo index 89bbced..d062d8a 100644 Binary files a/.vs/Calculator/v17/.suo and b/.vs/Calculator/v17/.suo differ diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index 6b61141..a3476af 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -2,5 +2,6 @@ "ExpandedNodes": [ "" ], + "SelectedNode": "\\Calculator.sln", "PreviewInSolutionExplorer": false } \ No newline at end of file diff --git a/.vs/calc_version4/v17/.wsuo b/.vs/calc_version4/v17/.wsuo new file mode 100644 index 0000000..6a477ba Binary files /dev/null and b/.vs/calc_version4/v17/.wsuo differ diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 7978d09..423a8bf 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -236,19 +236,19 @@ // // textBox1 // - this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.textBox1.Location = new System.Drawing.Point(71, 79); + this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.textBox1.Location = new System.Drawing.Point(26, 110); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(338, 80); + this.textBox1.Size = new System.Drawing.Size(397, 40); this.textBox1.TabIndex = 15; this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged_1); // // textBox2 // - this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.textBox2.Location = new System.Drawing.Point(559, 78); + this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.textBox2.Location = new System.Drawing.Point(529, 106); this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(781, 80); + this.textBox2.Size = new System.Drawing.Size(781, 44); this.textBox2.TabIndex = 16; this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); // @@ -256,18 +256,19 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.label2.Location = new System.Drawing.Point(64, 25); + this.label2.Location = new System.Drawing.Point(64, 37); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(221, 42); this.label2.TabIndex = 17; this.label2.Text = "Выражения"; + this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.label2.Click += new System.EventHandler(this.label2_Click); // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.label3.Location = new System.Drawing.Point(550, 25); + this.label3.Location = new System.Drawing.Point(550, 37); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(197, 42); this.label3.TabIndex = 18; @@ -305,9 +306,10 @@ this.button17.BackColor = System.Drawing.Color.LightPink; this.button17.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.button17.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.button17.Location = new System.Drawing.Point(429, 85); + this.button17.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; + this.button17.Location = new System.Drawing.Point(429, 92); this.button17.Name = "button17"; - this.button17.Size = new System.Drawing.Size(94, 89); + this.button17.Size = new System.Drawing.Size(94, 74); this.button17.TabIndex = 21; this.button17.Text = "="; this.button17.UseVisualStyleBackColor = false; @@ -448,7 +450,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - this.ClientSize = new System.Drawing.Size(1352, 665); + this.ClientSize = new System.Drawing.Size(1283, 657); this.Controls.Add(this.button27); this.Controls.Add(this.button18); this.Controls.Add(this.button26); @@ -482,7 +484,7 @@ this.Controls.Add(this.button1); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.Name = "Form1"; - this.Text = "Form1"; + this.Text = "THE CALCULATR 3000"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Form1.cs b/Form1.cs index f754fc4..0231732 100644 --- a/Form1.cs +++ b/Form1.cs @@ -130,13 +130,14 @@ namespace Calculator private void button17_Click(object sender, EventArgs e) { - - + + try { string expression = textBox1.Text; Analaizer.expression = expression; + if (!Analaizer.CheckCurrency()) @@ -145,17 +146,19 @@ namespace Calculator return; } - expression = expression.Replace(" " , ""); - expression = expression.Replace("(", ""); - expression = expression.Replace(")", ""); + - if (expression.StartsWith("sin(",StringComparison.OrdinalIgnoreCase) && + expression = expression.Replace(" ", ""); + + + if (expression.StartsWith("sin(", StringComparison.OrdinalIgnoreCase) && expression.EndsWith(")")) { - string innerExpression = expression.Substring(4,expression.Length - 5); - if (double.TryParse(innerExpression,out double angle)) + string innerExpression = expression.Substring(4, expression.Length - 5); + if (double.TryParse(innerExpression, out double angle)) { double result = CalcClass.Sinus(angle); + textBox2.Text = result.ToString("F6"); return; } @@ -182,7 +185,28 @@ namespace Calculator } } - if (expression.Contains('+')) + else if (expression.Contains('(') || expression.Contains(')')) + + { + Analaizer.expression = expression; + string result = Analaizer.Estimate(); + + + if (result.StartsWith("Error")) + { + textBox2.Text = "ошибка"; + + } + else + { + textBox2.Text = result; + } + return; + } + + + + else if (expression.Contains('+')) { string[] parts = expression.Split('+'); if (parts.Length >= 2) diff --git a/bin/Debug/Calculator.exe b/bin/Debug/Calculator.exe index 6d40e06..0b4db75 100644 Binary files a/bin/Debug/Calculator.exe and b/bin/Debug/Calculator.exe differ diff --git a/bin/Debug/Calculator.pdb b/bin/Debug/Calculator.pdb index e672b01..f8d31c7 100644 Binary files a/bin/Debug/Calculator.pdb and b/bin/Debug/Calculator.pdb differ diff --git a/obj/Debug/Calculator.csproj.AssemblyReference.cache b/obj/Debug/Calculator.csproj.AssemblyReference.cache index f16b97c..8ee7038 100644 Binary files a/obj/Debug/Calculator.csproj.AssemblyReference.cache and b/obj/Debug/Calculator.csproj.AssemblyReference.cache differ diff --git a/obj/Debug/Calculator.csproj.CoreCompileInputs.cache b/obj/Debug/Calculator.csproj.CoreCompileInputs.cache index 0bdc5c3..b0d6310 100644 --- a/obj/Debug/Calculator.csproj.CoreCompileInputs.cache +++ b/obj/Debug/Calculator.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -dfad68e59b1a7b1521ac767c0c2131b1854d75890d1965b341aa3a4a598c0466 +d004777b21b377d6d22bd1594218e7558a685dbb9550b72628da5d93ea66b998 diff --git a/obj/Debug/Calculator.csproj.FileListAbsolute.txt b/obj/Debug/Calculator.csproj.FileListAbsolute.txt index 4d0c668..b204ee7 100644 --- a/obj/Debug/Calculator.csproj.FileListAbsolute.txt +++ b/obj/Debug/Calculator.csproj.FileListAbsolute.txt @@ -23,3 +23,15 @@ C:\Users\Student\Desktop\pOSHVA\obj\Debug\Calculator.csproj.CoreCompileInputs.ca C:\Users\Student\Desktop\pOSHVA\obj\Debug\Calculator.csproj.CopyComplete C:\Users\Student\Desktop\pOSHVA\obj\Debug\Calculator.exe C:\Users\Student\Desktop\pOSHVA\obj\Debug\Calculator.pdb +C:\Users\Student\Source\Repos\calc_version4\bin\Debug\Calculator.exe.config +C:\Users\Student\Source\Repos\calc_version4\bin\Debug\Calculator.exe +C:\Users\Student\Source\Repos\calc_version4\bin\Debug\Calculator.pdb +C:\Users\Student\Source\Repos\calc_version4\bin\Debug\CalcClass.dll +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.csproj.AssemblyReference.cache +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.Form1.resources +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.Properties.Resources.resources +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.csproj.GenerateResource.cache +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.csproj.CoreCompileInputs.cache +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.csproj.CopyComplete +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.exe +C:\Users\Student\Source\Repos\calc_version4\obj\Debug\Calculator.pdb diff --git a/obj/Debug/Calculator.csproj.GenerateResource.cache b/obj/Debug/Calculator.csproj.GenerateResource.cache index e65a386..16bdb6d 100644 Binary files a/obj/Debug/Calculator.csproj.GenerateResource.cache and b/obj/Debug/Calculator.csproj.GenerateResource.cache differ diff --git a/obj/Debug/Calculator.exe b/obj/Debug/Calculator.exe index 6d40e06..0b4db75 100644 Binary files a/obj/Debug/Calculator.exe and b/obj/Debug/Calculator.exe differ diff --git a/obj/Debug/Calculator.pdb b/obj/Debug/Calculator.pdb index e672b01..f8d31c7 100644 Binary files a/obj/Debug/Calculator.pdb and b/obj/Debug/Calculator.pdb differ diff --git a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 0ad2f09..53f8454 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ