add:哈希框架
This commit is contained in:
parent
a0cf906b69
commit
b59166b198
|
@ -21,11 +21,48 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <transform.h>
|
||||
#include <string.h>
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
int testa[4];
|
||||
int i = 0;
|
||||
|
||||
void TestHash(void)
|
||||
void TestHash(int argc, char *argv[])
|
||||
{
|
||||
printf("hallo!Hash.\n");
|
||||
if (argc > 1)
|
||||
{
|
||||
// 对哈希表的一些操作
|
||||
for (int arg = 0; arg < argc; arg ++)
|
||||
{
|
||||
// printf("the commend is %s.\n",argv[arg]);
|
||||
if (strcmp(argv[arg],"--insert") == 0)
|
||||
{
|
||||
testa[i] = atoi(argv[arg + 1]);
|
||||
i++;
|
||||
for (int j = 0; j < 4; j++)
|
||||
printf("testa[%d]:%d\n",j,testa[j]);
|
||||
printf("insert hash table,insert element is %s.\n",argv[arg + 1]);
|
||||
}
|
||||
if (strcmp(argv[arg],"--delete") == 0)
|
||||
{
|
||||
// TODO:实现hash的删除操作
|
||||
printf("delete index is %s.\n",argv[arg + 1]);
|
||||
}
|
||||
if (strcmp(argv[arg],"--search") == 0)
|
||||
{
|
||||
// TODO:实现hash的查找操作
|
||||
printf("search hash table.");
|
||||
}
|
||||
if (strcmp(argv[arg],"--update") == 0)
|
||||
{
|
||||
// TODO:实现hash的修改操作
|
||||
printf("update index is %s.\n",argv[arg + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("nothing to do.\n");
|
||||
}
|
||||
}
|
||||
PRIV_SHELL_CMD_FUNCTION(TestHash, a hash test sample, PRIV_SHELL_CMD_MAIN_ATTR);
|
||||
#endif
|
Loading…
Reference in New Issue