Click here to Skip to main content
15,888,733 members
Home / Discussions / C#
   

C#

 
QuestionRegex replace exact 5 digit not more than that Pin
shakumar_219-Mar-15 1:41
shakumar_219-Mar-15 1:41 
AnswerRe: Regex replace exact 5 digit not more than that Pin
OriginalGriff9-Mar-15 2:47
mveOriginalGriff9-Mar-15 2:47 
GeneralRe: Regex replace exact 5 digit not more than that Pin
sudabeh39-Mar-15 15:17
sudabeh39-Mar-15 15:17 
GeneralRe: Regex replace exact 5 digit not more than that Pin
Pete O'Hanlon9-Mar-15 20:13
mvePete O'Hanlon9-Mar-15 20:13 
GeneralRe: Regex replace exact 5 digit not more than that Pin
OriginalGriff9-Mar-15 21:21
mveOriginalGriff9-Mar-15 21:21 
Questionconverting c#code into matlab. Pin
Member 114388619-Mar-15 1:12
Member 114388619-Mar-15 1:12 
AnswerRe: converting c#code into matlab. Pin
Eddy Vluggen9-Mar-15 1:26
professionalEddy Vluggen9-Mar-15 1:26 
QuestionCryptarithmetic problem solving Pin
Member 114388619-Mar-15 1:06
Member 114388619-Mar-15 1:06 
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 | :confused:
please help.... Cry | :((

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<s1.length;i++)
{
="" for(int="" j="0;j<=topc;j++)
" if="" (s1[i]="" !="c[j])
" (i="=" 0)=""
="" i++;="" flag="1;
" }
="" else
="" break;
="" if(flag="=1)
" c[topc++]="s1[i];" i="0;i<s2.Length;i++)
" if(s2[i]!="c[j])
" if(s3[i]!="c[j])
" }

="" (solve(0,="" assinged)="=1)
" label4.text="" +="\n" c[i]+"---="">"+val[i].ToString() + "\n";
}
else
label4.Text = "Sorry";
}

//-------------------end of getdata-----------------




int solve(int ind,int []temp1)
{
int [] temp2 = new int[10];
int flag=0;
for(int i=0;i<10;i++)
{
if(temp1[i]==0)
{
for(int j=0;j<10;j++)
temp2[j]=temp1[j];
temp2[i]=1;
val[ind]=i;
if(ind==(topc-1))
{
if(verify()==1)
{
flag=1;
goto exit;
}
}
else{
if(solve(ind+1,temp2)==1){
flag=1;
goto exit;
}
}
}
}
exit :
if(flag!=0)
return 1;
else
return 0;
}
int verify()
{
long n1=0,n2=0,n3=0;
long power=1;
char ch;
int i=s1.Length-1;
int in1;
while(i>=0)
{
ch=s1[i];
in1=0;
while(in1!=topc)
{
if(c[in1]==ch)
break;
else
in1++;
}
n1+=power*val[in1];
power *=10;
i--;
}
power=1;
i=s2.Length-1;
while(i>=0)
{
ch=s2[i];
in1=0;
while(in1!=topc)
{
if(c[in1]==ch)
break;
else
in1++;
}
n2+=power*val[in1];
power *=10;
i--;
}
power=1;
i=s3.Length-1;
while(i>=0)
{
ch=s3[i];
in1=0;
while(in1!=topc)
{
if(c[in1]==ch)
break;
else
in1++;
}
n3+=power*val[in1];
power *=10;
i--;
}
if(n1+n2==n3)
return 1;
else
return 0;
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{
}

private void btn_cancel_Click(object sender, EventArgs e)
{
textBox1.Text = " ";
textBox2.Text = " ";
textBox3.Text = " ";
label4.Text = "";



}



}
}
AnswerRe: Cryptarithmetic problem solving Pin
Eddy Vluggen9-Mar-15 1:28
professionalEddy Vluggen9-Mar-15 1:28 
AnswerRe: Cryptarithmetic problem solving Pin
Gonzoox9-Mar-15 7:30
Gonzoox9-Mar-15 7:30 
QuestionHow can I send a text box value from one form to another?(C#) Pin
Akbar Fardi9-Mar-15 0:27
Akbar Fardi9-Mar-15 0:27 
AnswerRe: How can I send a text box value from one form to another?(C#) Pin
Richard MacCutchan9-Mar-15 0:55
mveRichard MacCutchan9-Mar-15 0:55 
GeneralRe: How can I send a text box value from one form to another?(C#) Pin
Akbar Fardi9-Mar-15 8:45
Akbar Fardi9-Mar-15 8:45 
GeneralRe: How can I send a text box value from one form to another?(C#) Pin
Richard MacCutchan9-Mar-15 22:09
mveRichard MacCutchan9-Mar-15 22:09 
Questionwebsocket Pin
Member 114846248-Mar-15 23:44
Member 114846248-Mar-15 23:44 
AnswerRe: websocket Pin
Richard MacCutchan9-Mar-15 0:15
mveRichard MacCutchan9-Mar-15 0:15 
QuestionIs it possibe execute 1st-thread method in 2nd async thread? Pin
Monookiev8-Mar-15 4:52
Monookiev8-Mar-15 4:52 
AnswerRe: Is it possibe execute 1st-thread method in 2nd async thread? Pin
OriginalGriff8-Mar-15 5:56
mveOriginalGriff8-Mar-15 5:56 
GeneralRe: Is it possibe execute 1st-thread method in 2nd async thread? Pin
Monookiev8-Mar-15 6:47
Monookiev8-Mar-15 6:47 
GeneralRe: Is it possibe execute 1st-thread method in 2nd async thread? Pin
OriginalGriff8-Mar-15 6:56
mveOriginalGriff8-Mar-15 6:56 
AnswerRe: Is it possibe execute 1st-thread method in 2nd async thread? Pin
OriginalGriff8-Mar-15 7:33
mveOriginalGriff8-Mar-15 7:33 
GeneralRe: Is it possibe execute 1st-thread method in 2nd async thread? Pin
Monookiev8-Mar-15 10:26
Monookiev8-Mar-15 10:26 
QuestionWSDL without Header but requested Pin
Info service8-Mar-15 0:02
Info service8-Mar-15 0:02 
AnswerRe: WSDL without Header but requested Pin
Richard MacCutchan8-Mar-15 2:11
mveRichard MacCutchan8-Mar-15 2:11 
GeneralRe: WSDL without Header but requested Pin
Info service8-Mar-15 5:52
Info service8-Mar-15 5:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.