【C++实战小项目】通讯录(三)数组模拟实现通讯录三大功能_c+(1)

cout << "1.yes";
cout << endl << "2.no" << endl;
int yesno1;
cin >> yesno1;
if (yesno1 == 1)
{
	over(ss);
}
else
{
	system("pause");
	playfirst();
}

}


基本如图所示




---


## 三.查找


删除是string3\_函数,我们来看看


### 3.1 Flowchart流程图





 Created with Raphaël 2.2.0 
 


























 进入函数 
 




 询问查找方式 
 




 提取数据 
 




 符合查找方式 
 




 输出 
 




 回到开始页面 
 




 通知错误 
 





 yes 
 





 yes 
 




 no 
 







---


### 3.2 三千字代码实现


然后我们再看看code



void string3_()
{
string string0 = “=====================================\n”;
string string1 = “1.通过名字查=\n”;
string string2 = “2.通过性别查=\n”;
string string3 = “3.通过年龄查=\n”;
string string4 = “4.通过地址查=\n”;
out06(string0);
out06(string1);
out06(string2);
out06(string3);
out06(string4);
out06(string0);
int string7 = 0;
string7 = input(string7);
switch (string7)
{
case 1:
cha1_();
case 2:
cha2_();
case 3:
cha3_();
case 4:
cha4_();
}
}




---


通过switch来分别到cha1\_ ~ cha4\_



void cha1_()
{
string name1 = “请输入名字:>\n”;
out06(name1);
string chaname;
input_string(chaname);
chaname = stringaaaa;
int s = 0;
cout << " 姓名";
for (int j = 1; j <= 12; j++)
{
cout << " ";
}
cout << “性别”;
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << “年龄”;
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << “电话”;
for (int j = 1; j <= 20; j++)
{
cout << " ";
}
cout << “地址”;
cout << “\n”;
for (int i = 1; i <= z - 1; i++)
{
if (namez[i] == chaname)
{
s++;

		cout << " ";
		cout << namez[i];
		for (int j = 1; j <= 10; j++)
		{
			cout << " ";
		}
		cout << bgz[i];
		for (int j = 1; j <= 10; j++)
		{
			cout << " ";
		}
		cout << agez[i];
		for (int j = 1; j <= 20 - 1; j++)
		{
			cout << " ";
		}
		cout << phonez[i];
		for (int j = 1; j <= 20 - 1; j++)
		{
			cout << " ";
		}
		cout << homez[i];
		cout << "\n";
	}
}
if (s == 0)
{
	cout << "没有找到这个人";
}
system("pause");
playfirst();

}

void cha2_()
{
string name1 = “请输入性别:>\n”;
out06(name1);
string chaname;
input_string(chaname);
chaname = stringaaaa;
if (chaname == “男”)chaname = “男”;
else if (chaname == “女”) chaname = “女”;
else chaname = “不男不女”;
cout << " 姓名";
for (int j = 1; j <= 12; j++)
{
cout << " ";
}
cout << “性别”;
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << “年龄”;
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << “电话”;
for (int j = 1; j <= 20; j++)
{
cout << " ";
}
cout << “地址”;
cout << “\n”;
int s = 0;
for (int i = 1; i <= z - 1; i++)
{
if (bgz[i] == chaname)
{
s++;
cout << " ";
cout << namez[i];
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << bgz[i];
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << agez[i];
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << phonez[i];
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << homez[i];
cout << “\n”;
}
}
if (s == 0)
{
cout << “没有找到这个人”;
}
system(“pause”);
playfirst();
}

void cha3_()
{
string name1 = “请输入年龄:>\n”;
out06(name1);
int chaage;
int s = 0;
cin >> chaage;
cout << " 姓名";
for (int j = 1; j <= 12; j++)
{
cout << " ";
}
cout << “性别”;
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << “年龄”;
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << “电话”;
for (int j = 1; j <= 20; j++)
{
cout << " ";
}
cout << “地址”;
cout << “\n”;
cout << " “;
for (int i = 1; i <= z - 1; i++)
{
if (agez[i] == chaage)
{
s++;
cout << " 姓名”;
for (int j = 1; j <= 12; j++)
{
cout << " ";
}
cout << “性别”;
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << “年龄”;
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << “电话”;
for (int j = 1; j <= 20; j++)
{
cout << " ";
}
cout << “地址”;
cout << “\n”;
cout << " ";
cout << namez[i];
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << bgz[i];
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << agez[i];
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << phonez[i];
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << homez[i];
cout << “\n”;
}
}
if (s == 0)
{
cout << “没有找到这个人”;
}
system(“pause”);
playfirst();
}

void cha4_()
{
string name1 = “请输入地址:>\n”;
out06(name1);
string chaname;
input_string(chaname);
chaname = stringaaaa;
int s = 0;
cout << " 姓名";
for (int j = 1; j <= 12; j++)
{
cout << " ";
}
cout << “性别”;
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << “年龄”;
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}
cout << “电话”;
for (int j = 1; j <= 20; j++)
{
cout << " ";
}
cout << “地址”;
cout << “\n”;
cout << " ";
for (int i = 1; i <= z - 1; i++)
{
if (homez[i] == chaname)
{
s++;

		cout << namez[i];
		for (int j = 1; j <= 10; j++)
		{
			cout << " ";
		}
		cout << bgz[i];
		for (int j = 1; j <= 10; j++)
		{
			cout << " ";
		}
		cout << agez[i];
		for (int j = 1; j <= 20 - 1; j++)
		{
			cout << " ";
		}
		cout << phonez[i];
		for (int j = 1; j <= 20 - 1; j++)
		{
			cout << " ";
		}
		cout << homez[i];
		cout << "\n";
	}
}
if (s == 0)
{
	cout << "没有找到这个人";
}
system("pause");
playfirst();

}




---


## 四.修改


### 4.1 Flowchart流程图





 Created with Raphaël 2.2.0 
 























 进入函数 
 




 输入名字 
 




 判断 
 




 修改各项值 
 




 回到开始页面 
 




 通知错误 
 






 yes 
 




 no 
 







---


### 4.2 代码实现



void string4_()
{
printf(“请输入需要修改信息用户的名字:>\n”);
string chaname;
input_string(chaname);
chaname = stringaaaa;
int s = 0;
cout << " 姓名";
for (int j = 1; j <= 12; j++)
{
cout << " ";
}
cout << “性别”;
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << “年龄”;
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

ing(chaname);
chaname = stringaaaa;
int s = 0;
cout << " 姓名";
for (int j = 1; j <= 12; j++)
{
cout << " ";
}
cout << “性别”;
for (int j = 1; j <= 10; j++)
{
cout << " ";
}
cout << “年龄”;
for (int j = 1; j <= 20 - 1; j++)
{
cout << " ";
}

[外链图片转存中…(img-MkjAJ105-1714430108685)]
[外链图片转存中…(img-WPkbhqAx-1714430108686)]
[外链图片转存中…(img-gcHL1pu1-1714430108686)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

  • 26
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值