Home > Back-end >  What was wrong with c # order list data structure to solve
What was wrong with c # order list data structure to solve

Time:09-21

Class Program
{
The static void Main (string [] args)
{
Console. WriteLine (" please enter the sequence table capacity ");
Int b=the Convert. ToInt32 (Console. ReadLine ());
SeqList SQ=new SeqList (b);
Console. Write (" please enter a number as members of the order form first ");
A string of n=null;
Do
{

Int j=the Convert ToInt32 (Console. ReadLine ());
If (SQ. GetLength () + 1 & gt; B)
{
Console. WriteLine (" you input the number of elements in the sequence table is greater than the sequence table capacity of La!!! ");
The Console. ReadKey ();
break;

}
SQ. Append (m);
Console. Write (" whether or not to continue to order table to join member: (is: y, n, n) ");
N=Console. ReadLine ();
If (n=="y")
{
The Console. Write (" please enter the sequence table new members;" );
}
}
While (n=="y");
String c=null;
Int pos.
int num;
While (true)
{
Console. WriteLine ();
Console. WriteLine (" please input you want to perform the operation of the serial number: ");
Console. WriteLine (" a. get order the number of elements of the current data in the table ");
Console. WriteLine (" b. delete order all the data in the table element ");
Console. WriteLine (" c. appended at the end of the sequence table a data element ");
Console. WriteLine (" d. location specified in the order table insert an element ");
Console. WriteLine (" e. delete specified location element in the sequence table ");
Console. WriteLine (" f. access to specify the location element in the sequence table ");
C=Console. ReadLine ();
If (c==A)
{
Console. WriteLine (" the number of data elements in the sequence table is: {0} ", SQ. GetLength ());
}
Else if (c==B)
{
SQ. The Clear ();
Console. WriteLine (" all data elements in the sequence table has been deleted!!! "); }

Else if (=c=c)
{
Console. WriteLine (" please enter an integer to add in the tail end of the sequence table: ");
If (int. TryParse (Console. ReadLine (), out num))
{
SQ. Append (num);
//SL. PrintAllElem ();
for (int i=0; I & lt;=SQ. GetLength () - 1; I++)
{
Console. WriteLine (SQ. GetElem (I));
}
}
}
Else if (c==4)
{
The Console. Write (" please enter to insert data: ");

Int the nm.=the Convert ToInt32 (Console. ReadLine ());
Console. WriteLine (" please input the position of the insertion: ");
Int ps=the Convert. ToInt32 (Console. ReadLine ());
SQ. Insert (nm, ps);

for (int i=0; I & lt;=SQ. GetLength () - 1; I++)
{
Console. WriteLine (SQ. GetElem (I));
}
}
Else if (c==5)
{
The Console. Write (" please enter a location to remove elements: ");
If (int. TryParse (Console. ReadLine (), out pos))
{the Console. WriteLine (" the deleted data elements: {0} ", SQ. Delete (pos)); }
}

Else if (c==6)
{
The Console. Write (" please enter an integer: ");
If (int. TryParse (Console. ReadLine (), out pos))
{the Console. WriteLine (" specify the location of the data elements: {0} ", SQ, GetElem (pos)); }
}


}


}
  • Related