+ 2

C# Code project

I can't find the reasons of the bug. can someone help me? Error is about "z" or "l" letter in football for example This is my code: using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string[] words = { "home", "programming", "victory", "C#", "football", "sport", "book", "learn", "dream", "fun" }; string letter = Console.ReadLine(); bool find=false; for(int count=0;count<10;count++){ if(words[count].Contains(letter)){ Console.WriteLine(words[count]); find=true; } } if(!find) Console.WriteLine("No mach"); } } }

25th Mar 2024, 8:28 PM
mobina
mobina - avatar
16 Respostas
+ 3
mobina it is probably because of the string "No mach", it should be exactly the same sentence in the challange. See what is said it's probably "No match"
26th Mar 2024, 6:38 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 3
Welcome, the cases go wrong in case there is no match because of that misspell Good luck...
26th Mar 2024, 9:21 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 3
mobina you could post the screenshot in your feed and then post the link of that feed here.
26th Mar 2024, 10:36 PM
JaScript
JaScript - avatar
+ 2
The code works fine.
25th Mar 2024, 9:44 PM
JaScript
JaScript - avatar
+ 2
Dont worry! i like solving errors when i can! and more when the people is nice, like you! If you have other errors you can message me and ill try my best! <3
25th Mar 2024, 9:58 PM
Borjo
Borjo - avatar
+ 2
sent it! did you recive it?
25th Mar 2024, 10:07 PM
Borjo
Borjo - avatar
+ 2
Omg yess.thank you so much 🙏🏻.🇮🇱 Radin Masiha 🇮🇱
26th Mar 2024, 7:00 PM
mobina
mobina - avatar
+ 1
Hey! Seems like you forgot 'using System;'! You may have deleted it when you started programing this... Next time, you can notice it when there is an error that says "The name 'Console' does not exist in the current context". This is not a bug, but i recommend you to be more clean when coding, this is very hard to read and unclear with those veriable names, i have cleaned it a bit, you can acces it here-> https://pastebin.com/KviteG1j Have fun programing in C#! (●'◡'●)
25th Mar 2024, 9:39 PM
Borjo
Borjo - avatar
+ 1
Actually I used it but I didn't write it here .and its error is not about console. Just it can't find some specific letters.☹️.but thank you for your answer and your advice.🙏🏻sylviun I edited it
25th Mar 2024, 9:44 PM
mobina
mobina - avatar
+ 1
🥲🤔How can I share the screenshot of the errors? JaScript
25th Mar 2024, 9:49 PM
mobina
mobina - avatar
+ 1
it actually works fine for me when adding the 'using System;', and if you try to find something on the code, you can use ctrl+F. Otherwise, if you are trying to say that you want your code to find the words that contain an specific character, you will have to change the code completely. Also, for taking screenshots you can use Win+imp (windows) imp (linux, can variate) and i dont know on mac, but you can copy the error and paste it! i will try to find it and solve it for you!
25th Mar 2024, 9:54 PM
Borjo
Borjo - avatar
+ 1
Thank you so much🙏🏻
25th Mar 2024, 9:55 PM
mobina
mobina - avatar
+ 1
Actually, I can't open your link to see your clean code
25th Mar 2024, 9:59 PM
mobina
mobina - avatar
+ 1
That is nice of you <3
25th Mar 2024, 10:01 PM
mobina
mobina - avatar
+ 1
Try again! it worked for me now, but if it still doesnt work, i can send you privately to not bloat this thread.
25th Mar 2024, 10:04 PM
Borjo
Borjo - avatar
+ 1
Yes please 🙏🏻
25th Mar 2024, 10:05 PM
mobina
mobina - avatar