Accepting a list of 5 items - c# program, DOT NET Programming

Accepting a List of 5 Items - C# Program

Hello, I've been trying so many codes for this but those codes didn't work well. Please write the code for Accepting a List of 5 Items in c#.

 

Posted Date: 2/12/2013 1:17:44 AM | Location : United States





Program code for Accepting a List of 5 Items, implement it

using System;

using System.Collections;  

class ShoppingList

{

  public static void Main(string []args)

 {

  ArrayList n = new ArrayList ();

  n.Add(args[0]);

  n.Add(args[1]);

  n.Add(args[2]);

  n.Add(args[3]);

  n.Add(args[4]);  

  n.Sort();

  Console.WriteLine ("The items in the Shopping List are : ");  

  for (int i =0; i< nCount; i++)

  {

  Console.WriteLine((i+1) + " " +n[i]);

  }

  Console.WriteLine();  

  n.Remove(2); // Deletes an item frm list

  n.Add(3) = "Daljit"; // Adds an item in the list

  n.Add(5) = "End"; // Adds in the end of the list    

  Console.WriteLine ("The items in the Shopping List After modifying are : ");  

   for (int i =0; i< nCount; i++)

  {

   Console.WriteLine((i+1) + " " +n[i]);

  }  

  Console.ReadLine();

 }

}

Posted by diana | Posted Date: 2/12/2013 1:20:37 AM

Thanks for helping me in my assignment.

Posted by Aana | Posted Date: 2/12/2013 1:22:59 AM


Related Discussions:- Accepting a list of 5 items - c# program, Assignment Help, Ask Question on Accepting a list of 5 items - c# program, Get Answer, Expert's Help, Accepting a list of 5 items - c# program Discussions

Write discussion on Accepting a list of 5 items - c# program
Your posts are moderated
Related Questions
How can we implement singleton pattern in .NET ? The Singleton pattern basically focuses on having one and only one instance of the object running. Lets take an e.g. a windows

what is Entity-relationship diagram for e-resource planner software

The steps that occur when we request a ASPX page are as follows:- 1) The browser sends the request to the webserver. Now  assume that the webserver at the other end is IIS. 2

Project Description: i have predefined template which contains all my user details and there order details We have to create a login where a user uploads data. Mobile  Nam

Bug Correction and Prediction Project Description: The project is about the prediction of bugs and resolves the bug in the sample program using costriage algorithm. You have

What is the role of the DataSet object in ADO.NET? One of the major components of ADO.NET is the DataSet object, which always remains disconnected from the database and decreas

How do we connect to SQL SERVER, which namespace do we use ? The code is shown below, after that i will  give the explanation for it. For this sample we will also require a SQL

Question : (a) Explain fully how ADO.NET functions. Illustrate your answer using a diagram. (b) List and explain three methods of the SqlCommand class. (c) Give four o

What is Operator Overloading in .NET? It gives a way to define and use operators like +, -, and / for user-defined classes or structs. It permits us to define/redefine the way

What are similarities between Class and structure? The similarities between structures and classes are as follows:- 1) Both can have constructors, properties, methods, field