Task 1
Create a simple calculator for 4 arithmetic operations for real numbers.
???????????
X 2
Y 3
Z 6
+ - * /
X
Recommendations:
1. Create a project Wind ows Forms in MS Visual Studio;
2. When entering fractional numbers, use the fractional separator depending on the
Windows regional settings (semicolon);
3. Use the try statement to handle exceptions (incorrect data entry);
4. Processing of Click events for operation buttons is as follows (example for the + button)
private: System: Void button1_Click (System: Object ^ sender, System:: EventArgs ^
e) {
try
{
textBox3-> Text =
(Convert::ToDouble (textBox1-> Text) + Convert::ToDouble (textBox2-> Text)).
ToString ();
}
catch (...)
{
textBox3-> Text = "Error";
}
}
5. Perform the remaining operations in the same way, replacing + with -, *, /.