🔒 Closed C# stack HELP po.

Status
Not open for further replies.

Maginaku

Honorary Poster
Pa help naman po ayan gawa ko at ayan din po yung instructions paguude naman po
 

Attachments

  • Screenshot_20210107_173046.webp
    Screenshot_20210107_173046.webp
    16 KB · Views: 35
  • Screenshot_20210110_160859_com.radinc.csharpshell.webp
    Screenshot_20210110_160859_com.radinc.csharpshell.webp
    79.4 KB · Views: 25
Oo, or meron site mga programmer doon nagtatanong eh. Di ko tanda kung ano pangalan nung site na yun doon nalang sana mag tanong si ts lalo na puro programmer mga tumatambay doon.
 
Yup spamming na ginagawa mo kugn apulit ulit ka sa tanong mo. Fifo lang nman yan kaya mo na yan. mas mahihirapan ka kung di mo maiintindihan yan kasi pahirap ng pahirap yan
 
[XX='Stale, c: 657507, m: 520608'][/XX] saan po lods? Pa link naman po. Kaylngan lang talaga ng tulong. Salamat po.
 
Pa help naman po. Pa guide po. Please. Hirap lang po tlaga sa online class at. Wala pong ka close na matatanungan po. Salamat po. Sana ma help nyoko. Btw first year college po ako. Salamat po
 
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;
}
 
eto ayusin mo nalang at analyze mo rin

1610295212659.webp


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;
}
 
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;
}
eto 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
 
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.
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.
 
just search the error of course.
gawa ka din ng account sa stackoverflow para pwede ka din dun mag ask.

Pwede ka maglagay palagi ng try and catch exception.

Like this:

C#:
try {

YOU CODE HERE

}catch(Exception ex)
{
    //dito mo makikita yung main error tapos yun yung search mo
 Console.Error.WriteLine(ex.Message);
}
 
Status
Not open for further replies.

About this Thread

  • 20
    Replies
  • 692
    Views
  • 6
    Participants
Last reply from:
Maginaku

Online now

Members online
1,235
Guests online
934
Total visitors
2,169

Forum statistics

Threads
2,277,255
Posts
28,975,344
Members
1,229,792
Latest member
khennu
Back
Top