C++中区分大小写的字符串比较

Ama*_*eem -1 c++ string

任何人都可以让我知道字符串类的区分大小写的比较函数的确切c ++代码吗?

gra*_*eds 5

怎么样?

std::string str1, str2;
/* do stuff to str1 and str2 */
if (str1 == str2) { /* do something */ }
Run Code Online (Sandbox Code Playgroud)

要么

if (str1.compare(str2) == 0) { /* the strings are the same */ }
Run Code Online (Sandbox Code Playgroud)