我该怎么加一个else啊?
这是一个搜索程序,输入正确名字后就能显示该名字下的信息,但输入错误的话我想输出一个error,于是但我该在哪加一个输出语句啊?求大神解决下并说明下原因,本人较菜,谢谢大神了。#include<stdio.h>
#include<string.h>
#define N 5
struct add
{
char name[10];
char tel1[20];
char tel2[20];
char addr[15];
char email[30];
};
struct add people[N]={
{"Jack","13800000000","13800000001","shanghai","Jack@},
{"Mary","13900000000","13900000001","unknow","Mary@},
{"John","15100000000","05168320000","beijing","John@},
{"Smith","15200000000","unknow","unknow"," Rose#},
{"Rose","15600000000","152000000002","xzit","unknow"}
};
main()
{
char name1[10];
printf("please input name of whom you want to search\n");
gets(name1);
printf("%s%15s%15s%15s%15s\n","姓名","电话1","电话2","住址","邮箱");
for(int i=0;i<N;i++)
{
if(strcmp(people[i].name,name1)==0)
printf("%s%15s%15s%15s%18s\n",people[i].name,people[i].tel1,people[i].tel2,people[i].addr,people[i].email);
}
}