Strings and Characters Program
Write an application that uses string method CompareTo to compare two strings input by the user. Output whether the first string is less than, equal to or greater than the second.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Aug 8, 2013, 1:13 AM
Sunny SharmaPosted Aug 8, 2013, 1:23 AM
Very like I replied on your previous question, please don't assign your homework to the forum. Be specific with the problem stopping you from going ahead and share your code as it could be worthy getting help more than sooner.
Steph BassosPosted Aug 8, 2013, 1:08 AM
Posted Aug 8, 2013, 1:04 AM
string string1 = textBox1.Text;
string string2=textBox2.Text;
var result = string1.CompareTo(string2);
if (result == -1)
MessageBox.Show("Input 2 is bigger");
else if (result == 0)
MessageBox.Show("Both Input 1 & Input 2 are equal");
else
MessageBox.Show("Input 1 is bigger");