This is the code i tried so far, but it is giving error.
using System;
using System.Collections;
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(string word);
// Find the synonyms associated with a word
string[] FindSynonyms(string word);
// Returns a sorted list of all the words in the //thesaurus
string[] WordList();
}
public class ImpIThesaurus:IThesaurus
{
#region IThesaurus Members
public Hashtable ThesDict;
public ImpIThesaurus()
{
ThesDict = new Hashtable();
}
public void AddWord(string word, string[] synonyms)
{
for ( int i = 0; i < (synonyms.Length - 1); i++ )
{
ThesDict.Add(word,synonyms[i]);
}
}
public void RemoveWord(string word)
{
// TODO: Add ImpIThesaurs.RemoveWord implementation
}
public string[] FindSynonyms(string word)
{
// TODO: Add ImpIThesaurs.FindSynonyms implementation
return null;
}
public string[] WordList()
{
// TODO: Add ImpIThesaurs.WordList 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*******@gmail.coma écrit dans le message de news:
11*********************@d34g2000cwd.googlegroups.c om...
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(string word);
// Find the synonyms associated with a word
string[] FindSynonyms(string 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