Cryptarithmetic problem solving
-
can any help.. in this code the first letter of any string in the problem SEND + MORE = MONEY should not be 0. but its showing showing zero.. how to do this???:confused: please help.... :(( namespace CryptArithmetic { public partial class Form1 : Form { char[] s1 = new char[10]; char[] s2 = new char[10]; char[] s3 = new char[10]; int[] assinged = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; char[] c = new char[11]; int[] val = new int[11]; int topc = 0; public Form1() { InitializeComponent(); } private void btn_ok_Click(object sender, EventArgs e) { label4.Text = ""; s1 = textBox1.Text.ToCharArray(); s2 = textBox2.Text.ToCharArray(); s3 = textBox3.Text.ToCharArray(); int flag=0; //to check if no letter is repeated and store unique letters in array c[] from s arrays for(int i=0;i
-
can any help.. in this code the first letter of any string in the problem SEND + MORE = MONEY should not be 0. but its showing showing zero.. how to do this???:confused: please help.... :(( namespace CryptArithmetic { public partial class Form1 : Form { char[] s1 = new char[10]; char[] s2 = new char[10]; char[] s3 = new char[10]; int[] assinged = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; char[] c = new char[11]; int[] val = new int[11]; int topc = 0; public Form1() { InitializeComponent(); } private void btn_ok_Click(object sender, EventArgs e) { label4.Text = ""; s1 = textBox1.Text.ToCharArray(); s2 = textBox2.Text.ToCharArray(); s3 = textBox3.Text.ToCharArray(); int flag=0; //to check if no letter is repeated and store unique letters in array c[] from s arrays for(int i=0;i
Try the built-in encryption routines, they'll be a bit safer than shuffling some values. If you want help with this specific algo, you'll probably have to explain some more; which encryption-algo are you trying to implement? Also, you'd like to edit your post and put the code between "pre" tags to improve readability.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
can any help.. in this code the first letter of any string in the problem SEND + MORE = MONEY should not be 0. but its showing showing zero.. how to do this???:confused: please help.... :(( namespace CryptArithmetic { public partial class Form1 : Form { char[] s1 = new char[10]; char[] s2 = new char[10]; char[] s3 = new char[10]; int[] assinged = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; char[] c = new char[11]; int[] val = new int[11]; int topc = 0; public Form1() { InitializeComponent(); } private void btn_ok_Click(object sender, EventArgs e) { label4.Text = ""; s1 = textBox1.Text.ToCharArray(); s2 = textBox2.Text.ToCharArray(); s3 = textBox3.Text.ToCharArray(); int flag=0; //to check if no letter is repeated and store unique letters in array c[] from s arrays for(int i=0;i
I didn't read your code, but just in case, in C# (and almost every C base language) when counting an array/index, the very first position of the array will be 0/zero, it is common to see something like this in a for
for (i = 0:i<=Array.Lenght -1;i++){
//do whatever in here
}where you substract 1 to the Lenght of the array because even though the array length is 10 you start counting at 0 (0,1,2,3,4,5,6,7,8,9)
I want to die like my grandfather- asleep, not like the passengers in his car, screaming!