Advertisement
JuliaSakawa

Caixa Eletrônico

Feb 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 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 Caixa
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void pictureBox1_Click(object sender, EventArgs e)
  21. {
  22.  
  23. }
  24. private void pictureBox2_Click(object sender, EventArgs e)
  25. {
  26.  
  27. }
  28. private void pictureBox4_Click(object sender, EventArgs e)
  29. {
  30.  
  31. }
  32. private void pictureBox5_Click(object sender, EventArgs e)
  33. {
  34.  
  35. }
  36. private void pictureBox6_Click(object sender, EventArgs e)
  37. {
  38.  
  39. }
  40. private void pictureBox8_Click(object sender, EventArgs e)
  41. {
  42.  
  43. }
  44. private void label1_Click(object sender, EventArgs e)
  45. {
  46.  
  47. }
  48.  
  49. //Botâo Calcular
  50. private void button1_Click(object sender, EventArgs e)
  51. {
  52. int num, soma = 0;
  53. int contNota100 = 0, contNota50 = 0, contNota20 = 0, contNota10 = 0, contNota5 = 0, contNota2 = 0;
  54. num = int.Parse(textBox1.Text);
  55.  
  56. while (num != soma)
  57. {
  58. if ((num - soma) >= 100)
  59. {
  60. soma += 100;
  61. contNota100++;
  62. }
  63. if ((num - soma) >= 50)
  64. {
  65. soma += 50;
  66. contNota50++;
  67. }
  68. if ((num - soma) >= 20)
  69. {
  70. soma += 20;
  71. contNota20++;
  72. }
  73. if ((num - soma) >= 10)
  74. {
  75. soma += 10;
  76. contNota10++;
  77. }
  78.  
  79. if ((num - soma) >= 5)
  80. {
  81. soma += 5;
  82. contNota5++;
  83. }
  84.  
  85. if ((num - soma) >= 2)
  86. {
  87. soma += 2;
  88. contNota2++;
  89. }
  90. }
  91.  
  92. if (contNota100 > 0)
  93. {
  94. label7.Text += contNota100.ToString();
  95. }
  96.  
  97. if (contNota50 > 0)
  98. {
  99. label6.Text += contNota50.ToString();
  100. }
  101.  
  102. if (contNota20 > 0)
  103. {
  104. label5.Text += contNota20.ToString();
  105. }
  106.  
  107. if (contNota10 > 0)
  108. {
  109. label4.Text += contNota10.ToString();
  110. }
  111.  
  112. if (contNota5 > 0)
  113. {
  114. label3.Text += contNota5.ToString();
  115. }
  116.  
  117. if (contNota2 > 0)
  118. {
  119. label2.Text += contNota2.ToString();
  120. }
  121. }
  122.  
  123. private void textBox1_TextChanged(object sender, EventArgs e)
  124. {
  125.  
  126. }
  127. private void Form1_Load(object sender, EventArgs e)
  128. {
  129. }
  130.  
  131. private void label3_Click(object sender, EventArgs e)
  132. {
  133.  
  134. }
  135.  
  136. private void label1_Click_1(object sender, EventArgs e)
  137. {
  138.  
  139. }
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement