' // Процедура сортировки алгоритмом выборки Sub SelectionSort(ByRef array() As Integer, ByVal ToUpper As Boolean) Dim Dump As Integer Dim Index As Integer Dim Work As Integer
Do For i As Integer = Work To UBound(Array) If ToUpper = True Then If (Array(Index) > Array(i)) Then Index = i Else If (Array(Index) < Array(i)) Then Index = i End If Next
Dump = Array(Index) Array(Index) = Array(Work) Array(Work) = Dump ' // c2fbefeeebede8eb3a20caf3eff0e8ffedeee220c42ec52e2028632920442d6d6f6e3535 Work += 1 Index = Work Loop Until (Work > UBound(Array)) End Sub
Вот на шарпе. Console.WriteLine("s1="); string s1=Console.ReadLine(); int k=1;int max=0; for (int i = 1; i < s1.Length-1; i++) { if (s1[i-1] == s1[i]) { k++; } else { if (k > max) { max = k; k = 1; } } } Console.WriteLine(max); Console.ReadKey();
Sub SelectionSort(ByRef array() As Integer, ByVal ToUpper As Boolean)
Dim Dump As Integer
Dim Index As Integer
Dim Work As Integer
Do
For i As Integer = Work To UBound(Array)
If ToUpper = True Then
If (Array(Index) > Array(i)) Then Index = i
Else
If (Array(Index) < Array(i)) Then Index = i
End If
Next
Dump = Array(Index)
Array(Index) = Array(Work)
Array(Work) = Dump
' // c2fbefeeebede8eb3a20caf3eff0e8ffedeee220c42ec52e2028632920442d6d6f6e3535
Work += 1
Index = Work
Loop Until (Work > UBound(Array))
End Sub
Console.WriteLine("s1=");
string s1=Console.ReadLine();
int k=1;int max=0;
for (int i = 1; i < s1.Length-1; i++)
{
if (s1[i-1] == s1[i])
{
k++;
}
else
{
if (k > max)
{
max = k;
k = 1;
}
}
}
Console.WriteLine(max);
Console.ReadKey();