#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct student
{
char name[15];
char identify[18];
char telepnum[11];
}f_monitor,m_monitor;
char *findByName(char *name)
{
if(strcmp(name,m_monitor.name)==0)
{
printf(“您输入的是男班长的姓名!”);
return name;
}
if(strcmp(name,f_monitor.name)==0)
{
printf(“您输入的是女班长的姓名!”);
return name;
}
}
char *findById(char *identify)
{
if(strcmp(identify,m_monitor.identify)==0)
{
printf(“您输入的是男班长的身份证号码!”);
return identify;
}
if(strcmp(identify,f_monitor.identify)==0)
{
printf(“您输入的是女班长的身份证号码!”);
return identify;
}
}
int main()
{
char Name[15];
char tele[11];
char id[18];
char *pcval;
pcval=tele;
printf(“请输入男班长的姓名:”);
scanf(“%s”,m_monitor.name);
printf(“\n”);
printf(“请输入男班长的身份证号码:”);
scanf(“%s”,m_monitor.identify);
printf(“\n”);
printf(“请输入男班长的电话号码:”);
scanf(“%s”,m_monitor.telepnum);
printf(“\n”);
printf(“请输入女班长的姓名:”);
scanf(“%s”,f_monitor.name);
printf(“\n”);
printf(“请输入女班长的身份证号码:”);
scanf(“%s”,f_monitor.identify);
printf(“\n”);
printf(“请输入女班长的电话号码:”);
scanf(“%s”,f_monitor.telepnum);
printf(“\n”);
printf(“1.根据姓名查询电话号码! 2.根据身份证号码查询电话号码!\n”);
int op;
switch(op)
{
case 1:
printf(“请输入您所要查询人的姓名:”);
scanf(“%s”,Name);
*pcval=*findByName(Name);
printf(“电话号码是:%s”,*pcval);
break;
case 2:
printf(“请输入您所要查询人的身份证号码:”);
scanf(“%s”,id);
*pcval=*findById(id);
printf(“电话号码是:%s”,*pcval);
break;
}
system(“pause”);
return 0;
}
-
近期文章
近期评论
- coolker 发表在《打造最快的Hash表》
- struggle 发表在《提供C语言教学课件(适用于初学者)》
- zhanghaibo 发表在《提供C语言教学课件(适用于初学者)》
- zhanghaibo 发表在《提供C语言教学课件(适用于初学者)》
- diys 发表在《C语言编程宝典(王大刚) 1.1 C 语言的产生与发展》
文章归档
- 2022 年十月
- 2014 年一月
- 2013 年十二月
- 2012 年十一月
- 2012 年七月
- 2012 年六月
- 2012 年五月
- 2012 年四月
- 2012 年三月
- 2012 年二月
- 2011 年十二月
- 2011 年十月
- 2011 年九月
- 2011 年八月
- 2011 年七月
- 2011 年六月
- 2011 年五月
- 2011 年四月
- 2011 年三月
- 2011 年二月
- 2011 年一月
- 2010 年十二月
- 2010 年十一月
- 2010 年十月
- 2010 年九月
- 2010 年八月
- 2010 年七月
- 2010 年六月
- 2010 年五月
- 2010 年四月
- 2010 年三月
- 2010 年二月
- 2010 年一月
- 2009 年十二月
- 2009 年十一月
- 2009 年十月
- 2009 年九月
- 2009 年八月
- 2009 年七月
- 2009 年六月
- 2009 年五月
- 2009 年四月
- 2009 年三月
- 2009 年二月
- 2009 年一月
- 2008 年十二月
- 2008 年十一月
- 2008 年十月
- 2008 年九月
- 2008 年八月
- 2008 年七月
- 2008 年六月
- 2008 年五月
- 2008 年四月
- 2008 年三月
- 2008 年二月
- 2008 年一月
- 2007 年十二月
- 2007 年十一月
- 2007 年十月
- 2007 年九月
- 2007 年八月
- 2007 年七月
- 2007 年六月
- 2007 年三月
- 2007 年二月
- 2007 年一月
- 2006 年十二月
- 2006 年十一月
- 2006 年十月
- 2006 年九月
- 2006 年八月
- 2006 年七月
- 2006 年六月
- 2006 年五月
- 2006 年四月
- 2006 年三月
- 2006 年二月
- 2006 年一月
- 2005 年十二月
- 2005 年十一月
分类目录
功能