Saturday, March 8, 2008

SW210 Лабораторын ажил 1 - Шийдэл 4


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
bool a = true;

public Form1()
{
InitializeComponent();
}

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
a = true;
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
a = false;
}

private void button1_Click(object sender, EventArgs e)
{
try
{
double temp = Convert.ToDouble(textBox1.Text);

if (a == true) temp = temp * 9 / 5 + 32;
else temp = (temp - 32) * 5 / 9;

label2.Text = Convert.ToString(temp);
}
catch(FormatException ex)
{
label2.Text = "Тоо оруулна уу";
}
}
}
}

1 comment:

  1. sain bna uu? bagshaa sw210 hicheeliin lektsiin materialiig yagaad tavihgui bna aa

    ReplyDelete