Example #1
0
void findPet(const Tree * pt)
{
	Item temp;

	if (TreeIsEmpty(pt))
	{
		fputs("No entries!\n", stdout);
		return;
	}

	fputs("Please enter the name of pet you wish to find:\n", stdout);
	fgets(temp.petName, STRLEN, stdin);
	reject_ch(temp.petName, '\n');

	fputs("Please enter pet kind: \n", stdout);
	fgets(temp.petKind, STRLEN, stdin);
	reject_ch(temp.petKind, '\n');

	upperCase(temp.petName);
	upperCase(temp.petKind);

	printf("%s the %s ", temp.petName, temp.petKind);
	if (Intree(&temp, pt))
	{
		printf("is a member.\n");
	}
	else
	{
		printf("is not a member.\n");
	}
}
Example #2
0
void showpets(const Tree * pt)
{
    if (TreeIsEmpty(pt))
        puts("No entries!");
    else
        Traverse(pt, printitem);
}
Example #3
0
void dropPet(Tree * pt)
{
	Item temp;

	if (TreeIsEmpty(pt))
	{
		fputs("No entries!\n", stdout);
		return;								//如果树为空树,退出程序
	}

	fputs("Please enter the name of pet you wish to find:\n", stdout);
	fgets(temp.petName, STRLEN, stdin);
	reject_ch(temp.petName, '\n');

	fputs("Please enter pet kind: \n", stdout);
	fgets(temp.petKind, STRLEN, stdin);
	reject_ch(temp.petKind, '\n');

	upperCase(temp.petName);
	upperCase(temp.petKind);

	printf("%s the %s ", temp.petName, temp.petKind);
	if (DeleteItem(&temp, pt))
	{
		printf("is dropped from the club.\n");
	}
	else
	{
		printf("is not a member.\n");
	}
}
Example #4
0
void showpets(const Tree * pt){
	if(TreeIsEmpty(pt)){
		puts("No enteries");
	} 
	else{
		Traverse(pt,printitem);
	}
}
Example #5
0
void showPets(const Tree * pt)
{
	if (TreeIsEmpty(pt))
	{
		fputs("No entries!\n", stdout);
	}
	else
	{
		Traverse(pt, printItem);
	}
}
void findpet(const Tree * pt) {
	Pet temp;

	if (TreeIsEmpty(pt)) {
		puts("No entries.");
		return;
	}

	puts("Please enter name of pet you wish to find:");
	get(temp.name, STRLEN);
	uppercase(temp.name);
	printf("Here are all pets named %s:\n", temp.name);
	ApplyToNode(&temp, pt, printpet);
}
Example #7
0
void findpet(const Tree *pt){
	Item temp;
	if(TreeIsEmpty(pt)){
		puts("No Entries !");
		return ; //如果树为空,则退出函数
	}
	puts("Please enter name of pet you wish to find :");
	fgets(temp.petname,MAXN,stdin);
	puts("Please enter pet kind:");
	fgets(temp.petkind,MAXN,stdin);
	printf("%s the %s ",temp.petname,temp.petkind);
	if(InTree(&temp,pt)){
		printf("is a member.\n");
	}else{
		printf("is not a member.\n");
	}
}
Example #8
0
void droppet(Tree *pt){
	Item temp;
	if(TreeIsEmpty(pt)){
		puts("No Entries!");
		return ;
	}
	puts("Please enter name of pet you wish to delete :");
	fgets(temp.petname,MAXN,stdin);
	puts("Please enter pet kind:");
	fgets(temp.petkind,MAXN,stdin);
	printf("%s the %s ",temp.petname,temp.petkind);
	if(DelItem(&temp,pt)){
		printf("is drop form the club.\n");
	}else{
		printf("is not a member.\n");
	}
}
void droppet(Tree * pt) {
	Pet temp;

	if (TreeIsEmpty(pt)) {
		printf("No entries!\n");
		return;
	}

	puts("Please enter name of pet you wish to delete:");
	get(temp.name, STRLEN);
	puts("Please enter type of pet:");
	get(temp.type, STRLEN);
	uppercase(temp.name);
	uppercase(temp.type);
	printf("%s the %s ", temp.name, temp.type);
	if (DeletePet(&temp, pt))
		printf("is dropped from the club.\n");
	else
		printf("is not a member.\n");
}
Example #10
0
void droppet(Tree * pt)
{
    Item temp;

    if (TreeIsEmpty(pt))
    {
        puts("No entries!");
        return;     /* quit function if tree is empty */
    }

    puts("Please enter name of pet you wish to delete:");
    gets(temp.petname);
    puts("Please enter pet kind:");
    gets(temp.petkind);
    uppercase(temp.petname);
    uppercase(temp.petkind);
    printf("%s the %s ", temp.petname, temp.petkind);
    if (DeleteItem(&temp, pt))
        printf("is dropped from the club.\n");
    else
        printf("is not a member.\n");
}
Example #11
0
void findpet(const Tree * pt)
{
    Item temp;

    if (TreeIsEmpty(pt))
    {
        puts("No entries!");
        return;     /* quit function if tree is empty */
    }

    puts("Please enter name of pet you wish to find:");
    gets(temp.petname);
    puts("Please enter pet kind:");
    gets(temp.petkind);
    uppercase(temp.petname);
    uppercase(temp.petkind);
    printf("%s the %s ", temp.petname, temp.petkind);
    if (InTree(&temp, pt))
        printf("is a member.\n");
    else
        printf("is not a member.\n");
}
Example #12
0
void droppet(Tree * pt){
	Item temp;
	
	if(TreeIsEmpty(pt)){
		puts("No enteries");
		return;
	}
	
	puts("please enter the name of pet you wish to delete");
	gets(temp.petname);
	puts("please enter pet kind");
	gets(temp.petkind);
	uppercase(temp.petname);
	uppercase(temp.petkind);
	printf("%s the %s ",temp.petname ,temp.petkind );
	if(DeleteItem(&temp,pt)){
		printf("is dropped from the club.\n");
	}
	else{
		printf("is not a member.\n");
	}
}
Example #13
0
void findpet(const Tree *pt){
	Item temp;
	
	if(TreeIsEmpty(pt)){
		puts("No enteries");
		return;
		//此语句使函数退出 
	} 
	puts("Please enter the name of pet you wish to find:");
	gets(temp.petname);
	puts("please enter pet kind");
	gets(temp.petkind);
	uppercase(temp.petname);
	uppercase(temp.petkind);
	printf("%s the %s ",temp.petname ,temp.petkind );
	if(InTree(&temp,pt)){
		printf("is a member.\n");
	}
	else{
		printf("is not a member.\n");
	}
}