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.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Former memberPosted Aug 7, 2013, 9:13 PM EDT
Former memberPosted Aug 7, 2013, 9:04 PM EDT
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");
Steph Bassos13 pointsPosted Aug 7, 2013, 9:08 PM EDT
Sunny SharmaRank #223 · 11.1K pointsPosted Aug 7, 2013, 9:23 PM EDT
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.