c++大小写字母转换?

2025-04-13 19:46:00
推荐回答(1个)
回答1:

// file.cpp : Defines the entry point for the console application.
//字母大小写转换

#include "stdafx.h"
#include
#include
using namespace std;


int main(int argc, char* argv[])
{
    //声明字符数组
    char str[80],*p;
    int i;

    //转换字符串中的小写为大写
    cout<<"将字符串中的小写字母转换为大写"<    cout<<"请输入原字符串:"<    cin>>str;
    p=strupr(str);
    cout<<"p:"<    cout<<"string:"<    cout<<"___________________"<
    //转换字符串中的大写为小写
    cout<<"将字符串中的大写字母转换为小写"<    cout<<"请输入原字符串:"<    cin>>str;
    p=strlwr(str);
    cout<<"p:"<    cout<<"string:"<    cout<<"___________________"<}