示例#1
0
int main(int argc, const char * argv[]) {
    
    Hash Hashy;
    string name = "";
    
    Hashy.AddItem("wutong", "beer");
    Hashy.AddItem("sunsining", "wine");

//    Hashy.PrintItemsInIndex(0);
//    while(name != "exit"){
//        cout << "Search for ";
//        cin >> name;
//        if(name != "exit"){
//            Hashy.FindDrink(name);
//        }
//    }
    Hashy.PrintTable();
    while(name != "exit"){
        cout << "Remove ";
        cin >> name;
        if(name != "exit"){
            Hashy.RemoveItem(name);
        }
    }
    
    Hashy.PrintTable();
    
    return 0;
}
示例#2
0
int main(int argc, char** argv)
{

	Hash Hashy;
	
	string name = "";
	
	Hashy.AddItem("Paul","malibu");
	Hashy.AddItem("Annie", "vodka");
	Hashy.AddItem("Emma", "rhum");
	Hashy.AddItem("Celine", "passoa");
	Hashy.AddItem("Robert", "beer");
	Hashy.AddItem("Jerem", "water");
	
	
	Hashy.PrintTable();
	/*
	Hashy.PrintItemsInIndex(5);
	Hashy.PrintItemsInIndex(2);
	Hashy.PrintItemsInIndex(4);
	*/

	while(name != "exit")
	{
		cout << "Remove for ";
		cin >> name;
		if(name != "exit")
			Hashy.RemoveItem(name);
	}
	
	
	return 0;
}