This is the code i tried so far, but it is giving error.
using System;
using System.Collecti ons;
namespace Thesaurus
{
public interface IThesaurus
{
// Adds a word and its synonyms to the thesaurus
void AddWord(string word, string[] synonyms);
// Removes a word from the thesurus
void RemoveWord(stri ng word);
// Find the synonyms associated with a word
string[] FindSynonyms(st ring word);
// Returns a sorted list of all the words in the //thesaurus
string[] WordList();
}
public class ImpIThesaurus:I Thesaurus
{
#region IThesaurus Members
public Hashtable ThesDict;
public ImpIThesaurus()
{
ThesDict = new Hashtable();
}
public void AddWord(string word, string[] synonyms)
{
for ( int i = 0; i < (synonyms.Lengt h - 1); i++ )
{
ThesDict.Add(wo rd,synonyms[i]);
}
}
public void RemoveWord(stri ng word)
{
// TODO: Add ImpIThesaurs.Re moveWord implementation
}
public string[] FindSynonyms(st ring word)
{
// TODO: Add ImpIThesaurs.Fi ndSynonyms implementation
return null;
}
public string[] WordList()
{
// TODO: Add ImpIThesaurs.Wo rdList implementation
return null;
}
#endregion
}
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
ImpIThesaurus trs = new ImpIThesaurus() ;
string[] list = {"a","b","c" };
trs.AddWord("A" ,list);
//
// TODO: Add code to start application here
//
}
}
}
Martin CLAVREUIL wrote:
Hi,
Did you try by yourself first ?
Nobody here will do a program your asked to do but we can help.
Try to use a hashtable in order to store the data.
Good work,
Martin
<jo*******@gmai l.coma écrit dans le message de news:
11************* ********@d34g20 00...legro ups.com...
Hi Everybody!
Hoping that every body would be fine at this group.
I am learning c sharp. Please, if anybody can make this program, i
would be highly obliged.
Implement a thesaurus (a dictionary of synonyms) that implements the
IThesaurus interface
Interface IThesaurus
{
// Adds a word and its synonyms to the thesaurus
void AddWord(string word, string[] synonyms);
// Removes a word from the thesurus
void RemoveWord(stri ng word);
// Find the synonyms associated with a word
string[] FindSynonyms(st ring word);
// Returns a sorted list of all the words in the //thesaurus
string[] WordList();
}
Discuss your implementation. What kind of performance can you expect
from the operations? What should be done to make it threadsafe?
Thanks in Advance.
John