Pa help naman po ayan gawa ko at ayan din po yung instructions paguude naman po
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
var input = int.Parse(Console.ReadLine());
switch(input){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
}
Queue<string> queue = new Queue<string>();
start:
System.Console.WriteLine();
System.Console.WriteLine("===========");
System.Console.WriteLine("Queue Menu:");
System.Console.WriteLine("===========\n");
System.Console.WriteLine("[1] Add an element");
System.Console.WriteLine("[2] Remove front element");
System.Console.WriteLine("[3] Search an element");
System.Console.WriteLine("[4] Display all elements");
System.Console.WriteLine("[5] Exit");
System.Console.WriteLine();
choices:
System.Console.WriteLine();
System.Console.Write("Enter your choice > ");
var input = int.Parse(Console.ReadLine());
System.Console.WriteLine();
switch (input)
{
case 1:
System.Console.Write("Enter an item to add to queue > ");
var item = System.Console.ReadLine();
foreach (var i in item.Split(','))
{
queue.Enqueue(i);
}
System.Console.WriteLine($"{item} has been added to queue. Total: {queue.Count}");
goto choices;
case 2:
var deq = queue.Dequeue();
System.Console.WriteLine($"{deq} has been removed to queue");
goto choices;
case 3:
System.Console.Write("Enter an item to search > ");
var searchItem = Console.ReadLine();
var result = queue.FirstOrDefault(x => x.Contains(searchItem));
System.Console.WriteLine($"Found {result}");
goto choices;
case 4:
System.Console.WriteLine($"Queue Items {queue.Count}:");
foreach(var q in queue){ System.Console.WriteLine($"{q}");}
goto choices;
case 5:
goto start;
}
yung sa switch statement mo, yung case mo ay int.
Ganito dapat.
C#:var input = int.Parse(Console.ReadLine()); switch(input){ case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; }
Salamat po ah. God bless po. Maraming salamat po talaga. Aaralin kopo ito. Salamat poeto ayusin mo nalang at analyze mo rin
View attachment 1126471
C#:Queue<string> queue = new Queue<string>(); start: System.Console.WriteLine(); System.Console.WriteLine("==========="); System.Console.WriteLine("Queue Menu:"); System.Console.WriteLine("===========\n"); System.Console.WriteLine("[1] Add an element"); System.Console.WriteLine("[2] Remove front element"); System.Console.WriteLine("[3] Search an element"); System.Console.WriteLine("[4] Display all elements"); System.Console.WriteLine("[5] Exit"); System.Console.WriteLine(); choices: System.Console.WriteLine(); System.Console.Write("Enter your choice > "); var input = int.Parse(Console.ReadLine()); System.Console.WriteLine(); switch (input) { case 1: System.Console.Write("Enter an item to add to queue > "); var item = System.Console.ReadLine(); foreach (var i in item.Split(',')) { queue.Enqueue(i); } System.Console.WriteLine($"{item} has been added to queue. Total: {queue.Count}"); goto choices; case 2: var deq = queue.Dequeue(); System.Console.WriteLine($"{deq} has been removed to queue"); goto choices; case 3: System.Console.Write("Enter an item to search > "); var searchItem = Console.ReadLine(); var result = queue.FirstOrDefault(x => x.Contains(searchItem)); System.Console.WriteLine($"Found {result}"); goto choices; case 4: System.Console.WriteLine($"Queue Items {queue.Count}:"); foreach(var q in queue){ System.Console.WriteLine($"{q}");} goto choices; case 5: goto start; }
Salamat po ah. God bless po. Maraming salamat po talaga. Aaralin kopo ito. Salamat po
Salamat po ah. God bless po. Maraming salamat po talaga. Aaralin kopo ito. Salamat po
Salamat po ng marami. God bless.welcome lang. Aral lang ng mabuti. Ako di ako natutuo sa school kundi natuto lang with self learning with the help of google and stackoverlow. Hindi lahat ng question mo masasagot dito kaya need mo rin mag explore via searching.
Any advice po pala sapag sesearch sa mga problem kung ano po dapat unang gawin sapag sesearch. Ganun po.welcome lang. Aral lang ng mabuti. Ako di ako natutuo sa school kundi natuto lang with self learning with the help of google and stackoverlow. Hindi lahat ng question mo masasagot dito kaya need mo rin mag explore via searching.
try {
YOU CODE HERE
}catch(Exception ex)
{
//dito mo makikita yung main error tapos yun yung search mo
Console.Error.WriteLine(ex.Message);
}