手机通讯录(全文完整)

时间:2022-08-22 12:25:05 来源:网友投稿

下面是小编为大家整理的手机通讯录(全文完整),供大家参考。

手机通讯录(全文完整)

 

 #include <string.h> #include <stdio.h> #include <iostream.h> #include<iomanip.h> #include <stdlib.h> #include <conio.h>

 #include <windows.h> struct friends_list {

  char name[10];

 /* 姓名 */

  int age;

  /* 年龄 */

  char telephone[13];

 /* 联系电话 */

 char group[10]; };

 struct friends_list friends[50]; int Count=0; char mima[7]="888888",yhm[10]="host"; int user_record(); void new_friend(struct friends_list friends[ ]); void search_friend(); void search_basename(struct friends_list friends[ ],char *name); void search_basegroup(struct friends_list friends[ ]); void change_friend(); int change_user(); void main

 () {

 int choice,i,j;

 i=user_record();

  if(i==3)

 {

  cout<<"谢谢使用"<<endl;

  Sleep(1000);

  system("cls");

  return;

 }

 Sleep(1000);

 system("cls");

  cout<<"\n\n\t"<<"手机通讯录功能选项:

 "<<endl;

 cout<<"\t"<<"1.增加联系人"<<endl;

 cout<<"\t"<<"2.查找联系人"<<endl;

  cout<<"\t"<<"3.修改联系人"<<endl;

 cout<<"\t"<<"4.更改用户"<<endl;

  cout<<"\t"<<"0.退出"<<endl;

  do

 {

 cout<<"请选择功能:

 ";

  cin>>choice;

 switch(choice)

  {

 case 1:

 new_friend(friends);

  break;

 case 2:

 search_friend();

  break;

  case 3: change_friend();

  break;

  case 4:

  j=change_user();

  if(j==3)

  {

 cout<<"谢谢使用"<<endl;

 Sleep(1000);

 system("cls");

  return;

  }

 case 0: return;

  }

  }while(choice != 0);

  cout<<"谢谢使用通讯录功能!\n"; } int user_record() {

 bool pd;

 int

 i=0;

  char iyhm[10],imima[7];

 while(i<3)

 {

  cout<<"\n\n\t"<<"手机通讯录登陆\n"<<endl;

  cout<<setw(5)<<" "<<"输入用户名:";

 cin>>iyhm;

 cout<<setw(5)<<" "<<"输入密码:";

  cin>>imima;

  pd=(strcmp(yhm,iyhm)==0&&strcmp(imima,mima)==0);

  if(pd)

  {

 cout<<"\n\t 登陆成功"<<endl;

  Sleep(1000);

  system("cls");

  break;

  }

  else

  {

 cout<<"你的用户名或密码不正确"<<endl;

  Sleep(1000);

 system("cls");

  }

  i++;

 }

 return i; } void new_friend(struct friends_list friends[ ]) {

 struct friends_list f;

  if(Count == 50)

 {

  cout<<"通讯录已满!\n";

  return;

  }

  cout<<"请输入新联系人的姓名:";

  cin>>f.name;

  cout<<"请输入新联系人的年龄:";

  cin>>f.age;

  cout<<"请输入新联系人的联系电话:";

  cin>>f.telephone;

 cout<<"请输入分组:1 好友 2 同学 3 家人 4 陌生人"<<endl;

  cout<<"分组:";

 cin>>f.group;

  friends[Count] = f;

  Count++; } void search_friend() {

 int choice;

 char name[10];

  if(Count == 0)

 {

 cout<<"通讯录是空的!\n";

  return;

  }

  cout<<"\n\n\t"<<"查找联系人:

 "<<endl;

 cout<<"\t"<<"1.按姓名查找"<<endl;

  cout<<"\t"<<"2.按分组查找"<<endl;

  cout<<"\t"<<"0.退出"<<endl;

  do

 {

 cout<<"请选择功能:

 "; cin>>choice;

  switch(choice)

  {

 case 1: cout<<"请输入要查找的联系人名:";

 cin>>name;

  search_basename(friends,name);

 break;

 case 2:

 search_basegroup(friends);

  break;

 case 0: return;

  }

  }while(choice != 0); } void search_basename(struct friends_list friends[ ],char *name) {

  int i,flag=0;

 for(i=0;i<Count;i++)

 {

  if(strcmp(name, friends[i].name) == 0)

  flag=1;

 break;

 }

 /* 找到联系人*/

  if(flag)

  {

  cout<<"姓名: "<<friends[i].name<<endl;

  cout<<"年龄: "<< friends[i].age<<endl;

  cout<<"电话: "<< friends[i].telephone<<endl;

  cout<<"分组: "<< friends[i].group<<endl;

  }

  else

  cout<<"无此联系人!";

  } void search_basegroup(struct friends_list friends[ ]) {

 char group[10];

 int i,flag;

 cout<<"请输入要查找的分组名:";

  cin>>group;

  for(i=0;i<Count;i++)

 {

  if(strcmp(group, friends[i].group) == 0)

  flag=1;

 /* 找到联系人*/ if(flag)

  {

  cout<<"姓名: "<< friends[i].name<<endl;

  cout<<"年龄: "<< friends[i].age<<endl;

  cout<<"电话: "<< friends[i].telephone<<endl;

  cout<<"分组: "<< friends[i].group<<endl;

  }

 } } void change_friend() {

 struct friends_list f;

 char name[10];

 int i=0,choice,j=0,flag=0;;

 do

 {

  cout<<"请输入要修改的联系人名:";

  cin>>name;

  cout<<"\n";

 for(i=0;i<Count;i++)

  {

  if(strcmp(name, friends[i].name) == 0)

  flag=1;

 break;

 }

 /* 找到联系人*/

  if(flag)

  {

  cout<<"姓名: "<<friends[i].name<<endl;

  cout<<"年龄: "<< friends[i].age<<endl;

  cout<<"电话: "<< friends[i].telephone<<endl;

  cout<<"分组: "<< friends[i].group<<endl;

  }

  else

 cout<<"无此联系人!"<<endl; j++;

 }while(flag==0&&j<3);

 if(j==3)

  return;

 cout<<"\n\n\t"<<"选择修改项目:

 "<<endl; cout<<"\t"<<"1.修改姓名"<<endl;

 cout<<"\t"<<"2.修改姓名"<<endl;

  cout<<"\t"<<"3.修改联系电话"<<endl;

 cout<<"\t"<<"4.修改分组"<<endl;

  cout<<"\t"<<"5.修改后联系人"<<endl;

  cout<<"\t"<<"0.退出"<<endl;

 do

  {

 cout<<"请选择功能:

 ";

  cin>>choice;

  switch(choice)

  {

 case 1:

  cout<<"请输入修改后联系人的姓名:";

  cin>>f.name;

  strcpy(friends[i].name,f.name);

  break;

  case 2:

 cout<<"请输入修改后联系人的姓名:";

  cin>>f.age;

  friends[i].age=f.age;

  break;

  case 3:

  cout<<"请输入修改后联系人的联系电话:";

  cin>>f.telephone;

  strcpy(friends[i].telephone,f.telephone);

  break;

  case 4:

  cout<<"请输入新分组:1 好友 2 同学 3 家人 4 陌生人"<<endl;

  cout<<"分组:";

  cin>>f.group;

  strcpy(friends[i].group,f.group);

  break;

 case 5:

  cout<<"姓名: "<< friends[i].name<<endl;

  cout<<"年龄: "<< friends[i].age<<endl;

  cout<<"电话: "<< friends[i].telephone<<endl;

  cout<<"分组: "<< friends[i].group<<endl;

  break;

 case 0: return;

 }

  }while(choice != 0); }

  int change_user() {

 char iyhm[10],imima[7];

 int i,j,pd;

 do

 {

  cout<<setw(5)<<" "<<"输入原用户名:";

  cin>>iyhm;

  cout<<setw(5)<<" "<<"输入原密码:";

  cin>>imima;

  pd=(strcmp(yhm,iyhm)==0&&strcmp(iyhm,yhm)==0);

  if(pd)

  {

  cout<<setw(5)<<" "<<"输入新用户名:";

  cin>>yhm;

  cout<<endl;

 printf("\t\t 输入密码:");

  for(i=0;i<6;i++)

 {

  mima[i]=getch();

  putchar("*");

  }

 putchar("\n");

 cout<<"更改成功"<<endl;

 Sleep(1000);

 system("cls");

 j=user_record();

 return j;

  }

  else

  {

 cout<<"你的用户名或密码不正确"<<endl;

  Sleep(1000);

 system("cls");

  }

  i++;

 }while(i<3);

  if(i==3)

 {

  cout<<"更改失败"<<endl; return 0;

  }

  return 0; 您好, 我是长安大学大一学生, 希望能在暑假加入夏之星教育机构从事家教工作, 希望您能给予机会。

 我性格开朗, 善于交际, 长于表达, 在学校彩虹驿站任干事, 并在班级任班委, 积累了与人交流的能力。

 自初中以来从事兼职, 做过电话推销、 营业员等工作, 培养了强烈的责任心和职业道德。

 高中毕业于省级重点中学河北正定中学, 大学以来成绩优异, 在所在班级排名第三, 有信心帮助低年级同学提高成绩。

推荐访问:手机通讯录 通讯录 完整 全文