array_hastable_add.cs

using System;
using System.Collections;
//csc hastable_add.cs
namespace ex_hastable
{
public class HashtableDemo
{
private static Hashtable employees = new Hashtable();
private static Hashtable emp = new Hashtable();
// public string str1= "";
public string s2 = "";
public string sta1 = "";
public string sta2 = "";
public string sta3 = "";
public string sta4 = "";


public void set_pwd()
{
Console.WriteLine("--data set -1-- " );
Console.Write("Enter name: " );
sta2 = Console.ReadLine();
Console.Write("Enter pwd: " );
sta1 = Console.ReadLine();
//
Console.WriteLine("--data set -1-- " );
Console.Write("Enter name: " );
sta4 = Console.ReadLine();
Console.Write("Enter pwd: " );
sta3 = Console.ReadLine();
emp.Add(sta1, sta2);
emp.Add(sta3,sta4);
//sta3 = (string)emp[ss];
//Console.WriteLine("Name and pwd : "+ sta3 );

}

public string find_name(string ss){
//Console.Write("enter a pwd " );
//tr_pwd =(string)Console.ReadLine();
if (emp.ContainsKey(ss)){
s2 = (string)emp[ss];
Console.WriteLine("Welcome " + s2);}
return s2;
}
}
class test
{
static void Main()
{

HashtableDemo pwd = new HashtableDemo();
pwd.set_pwd();
Console.Write("Enter pwd search :");
string st =Console.ReadLine();
pwd.find_name(st);
Console.ReadLine();

}
}
}