Các bro xem dùm code mình sai chỗ nào mà ko thể hiển thị kết quả ra output được
Thanks!
Mã:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace lab2_part2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
txtInputA.Text = "00000000";
txtInputB.Text = "00000001";
txtOutput.Text = "00000000";
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = true;
Thread.Sleep(1000);
char[] inputA = txtInputA.Text.ToCharArray();
char[] inputB = txtInputB.Text.ToCharArray();
char[] output = txtOutput.Text.ToCharArray();
char[] mangnho = new char[inputA.Length];
for (int i = inputA.Length - 1; i >= 0; i--)
{
if (inputA[i] == inputB[i])
if (inputA[i] == '1')
{
mangnho[i] = '1';
output[i]= '0';
}
else
{
mangnho[i] = '0';
output[i] = '0';
}
else
{
mangnho[i] = '0';
output[i] = '1';
}
}
for (int i = inputA.Length - 1; i > 0; i--)
{
if (mangnho[i] =='1')
{
if (output[i - 1] == '0')
output[i - 1] = '1';
else
output[i - 1] = '0';
}
}
}
}
}
View more random threads:
Ngọc Bích xanh bản chất thuộc dòng đá đá hoa (jade). Và cẩm thạch là tên gọi chung của ngọc bích. Vì thực chất chúng thuộc dòng đá đa khoáng được hình thành từ chất Silicat dưới dạng dioxy. Ngọc bích...
Chia sẻ Vòng tay ngọc bích xanh là...