searches.c

来自「linux 软件工程师C语言版,经典linuxC语言编程,诸多案例」· C语言 代码 · 共 24 行

C
24
字号
#include<stdio.h>
#include<string.h>
#include"phbook.h"
void searches()
{
	char name[20];
	int i,key;
	key=0;
	printf("Whose number do you wanna find:");
	scanf("%s",&name);
	fp = fopen("file1","r");
    fread(s,sizeof(struct test),sumno,fp);
    fclose(fp);
	for(i=0;i<sumno;i++)
		if(strcmp(s[i].name,name)==0)
		{
			printf("The one you wanna find is:\n");
	        printf("%-20s %s\n",s[i].name,s[i].No);
			key++;
		}
	if(key==0)
		printf("The people you find is not in the phoonbook!");
	face();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?