//以后把你的错误代码贴出来呀
#include"stdio.h"
#include"string.h"
main() //有些编译器 main()函数必须有返回值,你试一试 int main()
{
char name[10];
int n;
struct data //结构体定义在main()函数前
{
char name[10];
int phonenumber;
char address[20];
char mail[20];
};
struct data num[]={{"小黄",110,"上海区","shanghai@},
{"小黑",112,"广东省","guangdong@},
{"小红",119,"湖南省","hunan@},
{"小明",120,"安微省","anwei@},
{"小白",117,"湖北省","hubei@}};
printf("**************************************************\n");
printf(" 数据库已有名字:%s,%s,%s,%s,%s\n",num[0].name ,num[1].name,num[2].name,num[3].name,num[4].name);
printf(" *****请输入姓名获得详细资料******\n");
printf("**************************************************\n");
printf("输入您想获得详细资料的人的名字: ");
gets(name);
int n;
for(n=0;n<=4;n++)
{
if(strcmp(name,num[n].name)==0)
printf("%s,%d,%s,%s\n",num[n].name ,num[n].phonenumber ,num[n].mail ,num[n].address);
}
}
//以后把你的错误代码贴出来呀
#include"stdio.h"
#include"string.h"
main() //有些编译器 main()函数必须有返回值,你试一试 int main()
{
char name[10];
int n;
struct data //结构体定义在main()函数前
{
char name[10];
int phonenumber;
char address[20];
char mail[20];
};
struct data num[]={{"小黄",110,"上海区","shanghai@},
{"小黑",112,"广东省","guangdong@},
{"小红",119,"湖南省","hunan@},
{"小明",120,"安微省","anwei@},
{"小白",117,"湖北省","hubei@}};
printf("**************************************************\n");
printf(" 数据库已有名字:%s,%s,%s,%s,%s\n",num[0].name ,num[1].name,num[2].name,num[3].name,num[4].name);
printf(" *****请输入姓名获得详细资料******\n");
printf("**************************************************\n");
printf("输入您想获得详细资料的人的名字: ");
gets(name);
int n;
for(n=0;n<=4;n++)
{
if(strcmp(name,num[n].name)==0)
printf("%s,%d,%s,%s\n",num[n].name ,num[n].phonenumber ,num[n].mail ,num[n].address);
}
}
//以后把你的错误代码贴出来呀
#include"stdio.h"
#include"string.h"
main() //有些编译器 main()函数必须有返回值,你试一试 int main()
{
char name[10];
int n;
struct data //结构体定义在main()函数前
{
char name[10];
int phonenumber;
char address[20];
char mail[20];
};
struct data num[]={{"小黄",110,"上海区","shanghai@},
{"小黑",112,"广东省","guangdong@},
{"小红",119,"湖南省","hunan@},
{"小明",120,"安微省","anwei@},
{"小白",117,"湖北省","hubei@}};
printf("**************************************************\n");
printf(" 数据库已有名字:%s,%s,%s,%s,%s\n",num[0].name ,num[1].name,num[2].name,num[3].name,num[4].name);
printf(" *****请输入姓名获得详细资料******\n");
printf("**************************************************\n");
printf("输入您想获得详细资料的人的名字: ");
gets(name);
int n;
for(n=0;n<=4;n++)
{
if(strcmp(name,num[n].name)==0)
printf("%s,%d,%s,%s\n",num[n].name ,num[n].phonenumber ,num[n].mail ,num[n].address);
}
}
//以后把你的错误代码贴出来呀
#include"stdio.h"
#include"string.h"
main() //有些编译器 main()函数必须有返回值,你试一试 int main()
{
char name[10];
int n;
struct data //结构体定义在main()函数前
{
char name[10];
int phonenumber;
char address[20];
char mail[20];
};
struct data num[]={{"小黄",110,"上海区","shanghai@},
{"小黑",112,"广东省","guangdong@},
{"小红",119,"湖南省","hunan@},
{"小明",120,"安微省","anwei@},
{"小白",117,"湖北省","hubei@}};
printf("**************************************************\n");
printf(" 数据库已有名字:%s,%s,%s,%s,%s\n",num[0].name ,num[1].name,num[2].name,num[3].name,num[4].name);
printf(" *****请输入姓名获得详细资料******\n");
printf("**************************************************\n");
printf("输入您想获得详细资料的人的名字: ");
gets(name);
int n;
for(n=0;n<=4;n++)
{
if(strcmp(name,num[n].name)==0)
printf("%s,%d,%s,%s\n",num[n].name ,num[n].phonenumber ,num[n].mail ,num[n].address);
}
}