Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace ef5
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. label4.Text = null;
  23. label5.Text = null;
  24. string s1 = textBox1.Text;
  25. string s2 = textBox2.Text;
  26. string s3 = textBox3.Text;
  27. double a, b, c;
  28. if (double.TryParse(s1, out a))
  29. {
  30. if (double.TryParse(s2, out b))
  31. {
  32. if (double.TryParse(s3, out c))
  33. {
  34. if (a > 0.0 && b > 0.0 && c > 0.0)
  35. {
  36.  
  37. double P = 2 * a * b + 2 * b * c + 2 * a * c;
  38. double V = a * b * c;
  39. label4.Text = "P = " + P.ToString();
  40. label5.Text = "V = " + V.ToString();
  41. }
  42. else
  43. label4.Text = "Liczby powinny być większe od zera";
  44. }
  45. else
  46. label4.Text = "Niepoprawna liczba!";
  47. }
  48. else
  49. label4.Text = "Niepoprawna liczba!";
  50.  
  51. }
  52. else label4.Text = "Niepoprawna liczba!";
  53. }
  54.  
  55.  
  56. private void label2_Click(object sender, EventArgs e)
  57. {
  58. }
  59.  
  60. private void label4_Click(object sender, EventArgs e)
  61. {
  62.  
  63. }
  64.  
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement