新版本VS不能使用原来字符串大小写转换函数解决办法

新版本VS不能使用原来字符串大小写转换函数解决办法:

#include<iostream>
#include<cstring>
using namespace std;
/*
  新版本的VS需要在原来大小写函数前加个下划线前缀“_”
*/
int main()
{
    
    
	// _strlwr()函数:将字符数组中存放的字符串中的所有大写字母变换成小写字母
	char str1[20] = "I AM a ";
	char str2[] = "boy";
	cout << _strlwr(str1) << endl;  // i am a
	cout << str1 << endl;  //已经变成i am a

	// _strupr()函数:将字符数组中存放的字符串中的所有小写字母变换成大写字母
	cout << _strupr(str2) << endl;  // BOY
	cout << str2 << endl;  //已经变成BOY
	return 0;
}

Guess you like

Origin blog.csdn.net/qq_47949604/article/details/120672841