Words in Intermediate C# | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

Words in Intermediate C#

The program you are given defines an array with 10 words and takes a letter as input. Write a program to iterate through the array and output words containing the taken letter. If there's no such word, the program should output, "No match". Sample Input I Sample Output fun Note and for your information to the Words problem solution: Recall the Contains() method. Code is below or on a separate page due to truncation.

26th Mar 2024, 6:09 PM
Michael
25 Antworten
+ 2
There is no code. Show your code. Describe the issue that you are facing.
26th Mar 2024, 6:13 PM
Lisa
Lisa - avatar
+ 2
Don't paste it in a comment. Copy the code in a code bit on playground. Save. Come back to this thread. Click +, Insert Code, sort for My Code Bits, select your code.
26th Mar 2024, 6:21 PM
Lisa
Lisa - avatar
+ 1
Can you link the code now?
26th Mar 2024, 6:16 PM
Lisa
Lisa - avatar
+ 1
Are you on Android? Click on the text, keep pressed. A menu should open.
26th Mar 2024, 7:24 PM
Lisa
Lisa - avatar
+ 1
Take the time you need. Try to put it in a script. We can still fix it tomorrow or so. 👍
26th Mar 2024, 7:41 PM
Lisa
Lisa - avatar
+ 1
Michael You can refer to this link and learn how to post a code in Q&A. https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app At a glance, it seems there are duplicated code at the beginning. Maybe it was a copy & paste error? And I also see you are mixing python syntax in the code, such as: foreach string letter in words:, also ; elif:
27th Mar 2024, 3:59 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
Michael If you have access to a pc, you can create your code on the web version. So that you can type your code while viewing the code you posted. Once you created the code, follow the instructions and post it here.
28th Mar 2024, 2:24 AM
Wong Hei Ming
Wong Hei Ming - avatar
0
How many times have you found anything unconditional go wrong with this app?
26th Mar 2024, 6:14 PM
Michael
0
My post hasn't appeared on my account as of yet. Thank you for bearing with me.
26th Mar 2024, 6:15 PM
Michael
0
No
26th Mar 2024, 6:19 PM
Michael
0
At the moment and after the instructions truncated my code, I'm not able to copy and paste it to put it to this forum.
26th Mar 2024, 6:20 PM
Michael
0
Here's an altered, plain text copy of my code in the comment text box in which will follow.
26th Mar 2024, 6:23 PM
Michael
0
My phone deleted it. The code will follow TBA
26th Mar 2024, 6:24 PM
Michael
0
There's no save, there's no select all, there's no cut, there's no paste, there's no copy, and there's no link to place anywhere in this app. Sounds like clerical items like cut, paste, and copy, perhaps more, isn't working on devices with an operating system. I'm saying all devices with an operating system, too.
26th Mar 2024, 7:22 PM
Michael
0
The code is TBA or to be announced. Thank you for your patience.
26th Mar 2024, 7:23 PM
Michael
0
Just like Android and iOS, 33% of the time it works. This code is lengthy and it looks like it exceeds my clipboard or character limit.
26th Mar 2024, 7:30 PM
Michael
0
I'll try again even if I have to piece it together.
26th Mar 2024, 7:31 PM
Michael
0
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string[] words = { "home", "programming",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(); int count = 0; //your code goes here foreach string letter in words: if(contains(words[count]): { Console.WriteLine(words[count]); count = count + 1; } elif:
26th Mar 2024, 7:31 PM
Michael
0
Console.WriteLine("No match"); count = count + 1; } } } }
26th Mar 2024, 7:32 PM
Michael
0
The last portion of code is the following: elif: { Console.WriteLine("No match"); count = count + 1; } } } } }
26th Mar 2024, 7:36 PM
Michael