Write a C# Sharp program to perform and ordinal comparison of two strings that only differ in case
- برمجة سي شارب
- برمجة
- 2021-05-30
- ahmadghneem
الأجوبة
using System;
class Example31
{
public static void Main() {
String str1 = "JAVA";
String str2 = "python";
String str;
int result;
Console.WriteLine();
Console.WriteLine("Compare the numeric values of the corresponding Char objects in each string.");
Console.WriteLine("str1 = '{0}', str2 = '{1}'", str1, str2);
result = String.CompareOrdinal(str1, str2);
str = ((result < 0) ? "less than" : ((result > 0) ? "greater than" : "equal to"));
Console.Write("String '{0}' is ", str1);
Console.Write("{0} ", str);
Console.WriteLine("String '{0}'.", str2);
}
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال