Difference between revisions of "In queue class definition, make use of the IsEmpty method in Show method"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
m
m
Line 2: Line 2:
  
 
<syntaxhighlight lang="C#">
 
<syntaxhighlight lang="C#">
                 if (!IsEmpty())
+
                 if (!IsEmpty())//This has changed from Rear != -1
 
                 {
 
                 {
 
                     Console.WriteLine();
 
                     Console.WriteLine();
Line 11: Line 11:
 
                     }
 
                     }
 
                     Console.WriteLine();
 
                     Console.WriteLine();
 +
                }
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 15:20, 24 May 2018

If I understand this correct it would be replace the condition within the if statement in Show, with !IsEmpty.

                if (!IsEmpty())//This has changed from Rear != -1
                {
                    Console.WriteLine();
                    Console.Write("The contents of the queue are: ");
                    foreach (var item in Contents)
                    {
                        Console.Write(item);
                    }
                    Console.WriteLine();
                }