[XX='Maginaku, c: 657241, m: 1658345'][/XX] sensya busy lods. parang di reliable yung compiler na yan. error naman yung code.
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
added loop to see the stored queue and adjust removed queueusing System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace CSharp_Shell
{
public class Program
{
public static void Main()
{
Queue<string> queue = new Queue<string>();
//Add an element
queue.Enqueue("Mama");
queue.Enqueue("Papa");
queue.Enqueue("ate");
queue.Enqueue("Kuya");
queue.Enqueue("Bunso");
Console.WriteLine("=>Queue Menu<=");
Console.WriteLine("1. Add an element(Back)");
Console.WriteLine("2. Remove front element");
Console.WriteLine("3. Search an element");
Console.WriteLine("4. Display Queue Elements");
Console.WriteLine("5. Exit");
Console.WriteLine("\nEnter Your Choice: ");
string input = Console.ReadLine();
int queueInput = int.Parse(input); // Assuming variable add holds an integer value
switch (queueInput)
{
case 1:
Console.WriteLine("Enter an item to add to Queue:");
string aa = Console.ReadLine();
queue.Enqueue(aa);
break;
case 2:
// I don't think this can remove the input from the queue
// Queue is first in first out
//Console.WriteLine("Enter an item you want to remove to Queue");
//string bb = Console.ReadLine();
queue.Dequeue();
break;
case 3:
Console.WriteLine("Enter an Element that you want to search in Queue");
string cc = Console.ReadLine();
if(queue.Contains(cc))
Console.WriteLine(cc + ": Found on Queue!");
else
Console.WriteLine("No item on Queue!");
break;
case 4:
Console.WriteLine("Queue Elements!");
foreach (var q in queue)
{
Console.WriteLine(q);
}
Console.ReadLine(); // To retain the screen
break;
case 5:
Console.WriteLine("Exit!");
break;
}
}
}
}
Solved na mga idol. Salamat po
Okay po.post your solution just in case may need. and give credit din sa naka solved =D
Lods. Eto po kaya alam nyo? Hindi ko matapos. Hindi ko kasi alam yung iba. Pa check nga po. Salamat popost your solution just in case may need. and give credit din sa naka solved =D