C++字符串大写字母转小写字母

#include <iostream>
#include <stdio.h>

using namespace std;

char* Capital_to_Small(char* str)
{
    char* temp = str;
    int len = strlen(temp);
    for (int i = 0; i < len; i++)
    {

        if (temp[i] >= 'A' && temp[i]<='Z')
        {
            temp[i] = temp[i] + 32;
        }
    }

    return str;
}

int main()
{
    char s[_MAX_PATH];
    cin >> s;
    Capital_to_Small(s);
    cout << s;

    getchar();

    return 0;
}

猜你喜欢

转载自www.cnblogs.com/strive-sun/p/12574341.html