C++中怎么把 Wintersday 字符串 转化为WINTERSDAY

来源:百度知道 编辑:UC知道 时间:2024/09/23 12:01:22
如题。这是我程序的一部分,比较文件中是否含有输入的单词
不区分大小写。
原来是你o(∩_∩)o...我知道你和jintianfree的。
请教:比较字符串而忽略大小可以用stricmp这个库函数,能写下这个转换的程序吗 急 在先等~

比较字符串而忽略大小可以用stricmp这个库函数啊。
如果非要转换的话可以参考这个函数:
Converts a character to upper case.

template<Class CharType>
CharType toupper(
CharType _Ch,
const locale& _Loc
)

Parameters
_Ch
The character to be converted to upper case.

_Loc
The locale containing the character to be converted.

Return Value
The character converted to upper case.

// locale_toupper.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
using namespace std;

int main( )
{
locale loc ( "German_Germany" );
char result1 = toupper ( 'h', loc );
cout << "The upper case of 'h' in the locale is: "
<< result1 << "." << endl;
char result2 = toupper ( 'H', loc );
cout << "The upper case of 'H' in the locale is: &q