write a program to accept name & sort them?



write a program to accept name & sort them?..

Answer / Tasdeeq Ahmad

"Here's an example of a simple C# program that accepts names and sorts them:nn```csharpnusing System;
using System.Collections.Generic;

namespace NameSorter{n class Program {n static void Main(string[] args) {n List<string> names = new List<string>();
Console.Write("Enter names (enter 'q' to quit): ");
string input;
while ((input = Console.ReadLine()) != "q") {n names.Add(input);
}n names.Sort();
foreach (string name in names) {n Console.WriteLine(name);n }n }n }n}"

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is collection process?

1 Answers  


What are the parts of a linked list?

1 Answers  


an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].

1 Answers  


Differentiate between push and pop?

1 Answers  


What are b tree keys?

1 Answers  


What is a graph?

4 Answers  


How does dynamic memory allocation help in managing data?

1 Answers  


Is array static or dynamic?

1 Answers  


There is a program which inserts and deletes node in a sorted singly linked list. There is a bug in one of the modules, how would you debug it?

1 Answers   DELL,


Is hashmap keyset ordered?

1 Answers  


Is data structure a data type?

1 Answers  


What is the difference between arrays sort and collections sort?

1 Answers  


Categories