| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 527 人关注过本帖
标题:求助求助。一题简单的C语言。大家帮帮忙速度解决啊!通讯录的
只看楼主 加入收藏
fzfu
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-12-26
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
求助求助。一题简单的C语言。大家帮帮忙速度解决啊!通讯录的
制作一个用C语言编写的。
学生通讯录系统设计。
不要用指针。不用文件那些。
只要用结构体编写一个简单的通讯录。


要求只有这两点:
a。 能建立、修改和增加学生信息
b。 能够多种方式查询


请大家帮下忙。速度点啊!!!!!
搜索更多相关主题的帖子: C语言 速度 通讯录 
2009-12-26 20:29
eumenides
Rank: 2
等 级:论坛游民
帖 子:18
专家分:36
注 册:2009-12-25
收藏
得分:20 
#include<stdio.h>
#include<string.h>
struct friends_list{
 char name[10];
 int age;
 char telephone[13];
};
int count=0;
void friends_new(struct friends_list friends[] );
void friends_search(struct friends_list friends[],char*name);
int main(void){
 char name[10];
 int choice;
 struct friends_list friends[50];
 do{
  printf("[1新建],[2]查询,[0]退出.\n");
  printf("请输入您的选择:");
  scanf("%d",&choice);
  switch(choice){
  case 1:friends_new(friends);
   break;
  case 2:printf("请输入姓名:");
   scanf("%s",name);
   friends_search(friends,name);
   break;
  case 0:break;
  }
 }while(choice!=0);
 printf("谢谢使用手机通讯录功能\n");
 return 0;
}
void friends_new(struct friends_list friends[])
{
 struct friends_list f;
 if (count==50){
  printf("通讯录已满\n");
  return;
 }
 
 else{
 printf("请输入姓名:");
 scanf("%s",f.name);
 printf("请输入年龄:");
 scanf("%d",&f.age);
 printf("请输入手机号:");
 scanf("%s",f.telephone);
 friends[count]=f;
 count++;
 return;
}
}
void friends_search(struct friends_list friends[],char*name)
{
 
 if(count==0){
  printf("通讯录为空\n");
  return;
 }
 else{
  int i,flag=0;
  for(i=0;i<count;i++){
  if(strcmp(name,friends[i].name)==0)
   flag=1;
  break;
  }
 
  if(flag){
   printf("姓名%s\n",friends[i].name);
   printf("年龄%d\n",friends[i].age);
   printf("手机号%s\n",friends[i].telephone);
   
  }
  else {
   printf("无此联系人\n");
  }
   return;
  
 }
}
2009-12-26 20:52
快速回复:求助求助。一题简单的C语言。大家帮帮忙速度解决啊!通讯录的
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019500 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved