C++ 提高教程 STL-字符串对比

 

# include<iostream>
# include<string>
using namespace std;

void test01()
{
	string str1 = "Hello";
	string str2 = "Hello";
	if (str1.compare(str2) == 0)
	{
		cout << "str1等于str2" << endl;
	}
}
int main()
{
	test01();
	system("pause");
	return 0;
}
全部评论

相关推荐

07-28 16:15
门头沟学院 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务