Hello, friend if you are searching for a character match in the array then don't worry you reached to the right blog.
Code start here...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace wordsSearchInArray {
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
for (int i = 0; i < words.Length; i++) {
//Console.WriteLine(words[i]);
foreach(char n in words[i]) {
if (n == char.Parse(letter)) {
Console.WriteLine(words[i]);
count++;
if (count > 0) {
break;
}
}
}
//if (count > 0) { break; }
}
if (count == 0) {
Console.WriteLine("No Match");
}
Console.ReadKey();
}
}
}
When entering 'o' the algorithm print all words that contain the 'o'-character which is shown below in output.
Output