Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- int a;
- if (!int.TryParse(tb1.Text, out a))
- {
- MessageBox.Show("Greska! pogresan unos prvog broja");
- }
- else
- {
- int b;
- if (!int.TryParse(tb2.Text, out b))
- {
- MessageBox.Show("Greska! pogresan unos prvog broja");
- }
- else{
- if (cb1.SelectedItem == "+")
- {
- tb3.Text = Convert.ToString(a + b);
- }
- else if (cb1.SelectedItem == "-")
- {
- tb3.Text = Convert.ToString(a - b);
- }
- else if (cb1.SelectedItem == "*")
- {
- tb3.Text = Convert.ToString(a * b);
- }
- else if (cb1.SelectedItem == "/")
- {
- tb3.Text = Convert.ToString(a / b);
- }
- else
- {
- MessageBox.Show("Niste odabrali operaciju");
- }
- }}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment