Guest User

Untitled

a guest
Apr 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 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.Windows.Forms;
  9. using System.Globalization;
  10.  
  11.  
  12. namespace WindowsFormsApplication1
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void button1_Click(object sender, EventArgs e)
  22.         {
  23.             double a = Convert.ToDouble(textBox1.Text);
  24.             int w = Convert.ToInt32(Math.Truncate(a));
  25.             int w2 = Convert.ToInt32((a - w)*10);
  26.             double b = Convert.ToDouble(textBox2.Text);
  27.             int t = Convert.ToInt32(Math.Truncate(b));
  28.             int t2 = Convert.ToInt32((b - t) * 10);
  29.             textBox3.Text = (Convert.ToString(w,2) + ',' + Convert.ToString(w2,2));
  30.    
  31.             textBox4.Text = (Convert.ToString(t, 2) + ',' + Convert.ToString(t2, 2));
  32.             double b2 = Convert.ToDouble(Convert.ToString(t, 2) + ',' + Convert.ToString(t2, 2));
  33.             double a2 = Convert.ToDouble(Convert.ToString(w, 2) + ',' + Convert.ToString(w2, 2));
  34.             string first = Convert.ToString((Convert.ToByte(t) - Convert.ToByte(w)), 2);
  35.             string last = Convert.ToString((Convert.ToByte(t2) - Convert.ToByte(w2)), 2);
  36.             textBox5.Text = (first+','+last);
  37.  
  38.         }
  39.  
  40.         private void Form1_Load(object sender, EventArgs e)
  41.         {
  42.  
  43.         }
  44.     }
  45. }
Add Comment
Please, Sign In to add comment