0% found this document useful (0 votes)
5 views2 pages

Kombinasi Sort dan Input Array C#

This document contains code for a program that takes user input of names, stores them in an array, sorts the array, and displays the sorted list of names. It prompts the user for the number of names, uses a for loop to input each name into an array, displays the unsorted list, uses nested for loops to sort the array, displays the sorted list, and then uses Array.Sort to sort the array and display the final sorted list.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Kombinasi Sort dan Input Array C#

This document contains code for a program that takes user input of names, stores them in an array, sorts the array, and displays the sorted list of names. It prompts the user for the number of names, uses a for loop to input each name into an array, displays the unsorted list, uses nested for loops to sort the array, displays the sorted list, and then uses Array.Sort to sort the array and display the final sorted list.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

using

using
using
using

System;
[Link];
[Link];
[Link];

namespace Hably_01
{
class Program
{
static void Main(string[] args)
{
[Link]("\t\t========================================\n");
[Link]("\t\tAPLIKASI KOMBINASI SORT DAN ARRAY INPUT \n");
[Link]("\t\t========================================\n");
[Link]("Berapa banyak data acak yang akan diurutkan ? ");
int maks = Convert.ToInt32([Link]());
string[] nama = new string[maks];
for (int i = 0; i < maks; i++)
{
[Link]("Masukkan Nama ke " + (i + 1).ToString() + " :
");

nama[i] = [Link]();
}
[Link]("\n\nSebelum Sorting :\n");
for (int k = 0; k < maks; k++)
[Link](nama[k] + " ");
[Link]("\n");
[Link]("\nSelama Sorting :\n");
for (int i = 1; i < maks; i++)
{
for (int j = 0; j < maks - i; j++)
{
string temp = nama[j];
nama[j] = nama[j + 1];
nama[j + 1] = temp;
}

for (int k = 0; k < maks; k++)


[Link](nama[k] + " ");
[Link]("\n");

[Link]("\nSetelah Sorting :");


[Link](nama);
foreach (string i in nama)
[Link](i + " ");
[Link]();

}
}

You might also like