Using System; using System. Speech. Synthesis


Download 7.98 Kb.
Sana18.06.2023
Hajmi7.98 Kb.
#1554620
Bog'liq
elodbek



using System;


using System.Speech.Synthesis;

namespace EnglishSpellChecker


{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to English Spell Checker!");

while (true)


{
Console.Write("Enter an English word: ");
string word = Console.ReadLine();

bool isSpelledCorrectly = CheckSpelling(word);


string feedback = isSpelledCorrectly ? "Correct spelling!" : "Incorrect spelling!";

Console.WriteLine(feedback);


SpeakWord(word);

Console.WriteLine();


Console.WriteLine("Press 'Q' to quit, or any other key to continue.");
ConsoleKeyInfo key = Console.ReadKey();

if (key.KeyChar == 'q' || key.KeyChar == 'Q')


break;

Console.Clear();


}
}

static bool CheckSpelling(string word)


{
return true;
}

static void SpeakWord(string word)


{
using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())
{
Console.WriteLine("Playing word pronunciation...");

try
{


synthesizer.SetOutputToDefaultAudioDevice();
synthesizer.Speak(word);
}
catch (Exception ex)
{
Console.WriteLine("An error occurred while playing the word pronunciation:");
Console.WriteLine(ex.Message);
}
}
}
}
}
Dasturni Visual Studio da yaratganingizda, EnglishSpellChecker nomli yangi proyekt yarating va Program.cs faylini ichiga yuklab olasz
Download 7.98 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling