Задача

1/13

Strings. Review. String comparison

Теория

Strings. Overview.

String is a list (or sequence) of characters in a specific order. The entire sequence of characters is treated as a single object.

A character is anything you can type on the keyboard with a single keystroke (letter, number, reverse slash or some other character).
Strings can have spaces: "Hello world!".
An empty string is a string that has 0 characters.
C sharp accepts as strings everything that is written in quotes (""), string is of type string.

Important to remember: strings in C# are immutable.

You can write a new value to a string using the input operator:
string s = Console.ReadLine(); 
You can also simply assign a string value to the variable, for example:
string s = "C sharp"; 
You can define the length of a string like this:
int n = s.Length;


String comparison. Strings can be compared to each other just like numbers. You can determine which of the lines is greater, which is less.

When comparing strings, character codes are compared. There are dozens, if not hundreds, of character encodings. The easiest way to understand this concept is to understand one of the simplest, ASCII (you can read about it here) . 
It is necessary to understand that in modern encodings both Russian and English letters are arranged in alphabetical order, the numbers also go from smaller to larger. 
For example, in the ASCII code table, the code for the English letter 'A' - 65, letters 'a' - 97, digit '0' has code 48. Russian letters are located in the extended part of the ASCII code table (numbers from 128 to 255). Capital letters come before (i.e. have a smaller code) than lowercase letters.
In most of the encoding tables used, the patterns are the same, lowercase letters are later than uppercase letters, numbers are earlier than letters, and Russian letters are later than English ones.
When comparing characters or strings, C# converts the characters to their respective ordinal values ​​and then compares from left to right. 

For example: "locomotive" < "steamboat", because the words differ in the fifth letter and "in" < "x".

Задача

Compare word pairs, answer with >, < or =.

steam and park

Выберите правильный ответ, либо введите его в поле ввода

Комментарий учителя