Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Cryptarithmetic problem solving

Cryptarithmetic problem solving

Scheduled Pinned Locked Moved C#
helpdata-structurestutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11404536
    wrote on last edited by
    #1

    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

    L G 2 Replies Last reply
    0
    • U User 11404536

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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[^]

      1 Reply Last reply
      0
      • U User 11404536

        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

        G Offline
        G Offline
        Gonzoox
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups