2024年【C++实战小项目】通讯录(三)数组模拟实现通讯录三大功能_c+(3),2024年最新零基础学习大数据开发

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

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

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

进入函数

提取数据

确认?

操作删除

回到开始页面

通知错误

yes

no

2.2 string2_

void string2\_()
{
	string name1 = "请输入名字:>\n";
	out06(name1);
	string chaname;
	input\_string(chaname);
	chaname = stringaaaa;
	int s = 0;
	int ss = 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++;
			ss = i;
			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 << "没有找到这个人";
	}
	cout << "确认删除该联系人吗";
	cout << endl;
	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++)
			{


![img](https://img-blog.csdnimg.cn/img_convert/07d4578956eadee464601f25be5a6c40.png)
![img](https://img-blog.csdnimg.cn/img_convert/30ed291bc6940ba7904f9edb8100079a.png)
![img](https://img-blog.csdnimg.cn/img_convert/307ea79e304052b79de77098e85f39e3.png)

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

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

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618545628)**

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++)
			{


[外链图片转存中...(img-ILrVpMW5-1714854257399)]
[外链图片转存中...(img-FhStoipP-1714854257399)]
[外链图片转存中...(img-F5SpJs9h-1714854257400)]

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

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

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618545628)**

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值