zoukankan      html  css  js  c++  java
  • AC日记——大小写字母互换 openjudge 1.7 14

    14:大小写字母互换

    总时间限制: 
    1000ms
     
    内存限制: 
    65536kB
    描述

    把一个字符串中所有出现的大写字母都替换成小写字母,同时把小写字母替换成大写字母。

    输入
    输入一行:待互换的字符串。
    输出
    输出一行:完成互换的字符串(字符串长度小于80)。
    样例输入
    If so, you already have a Google Account. You can sign in on the right. 
    样例输出
    iF SO, YOU ALREADY HAVE A gOOGLE aCCOUNT. yOU CAN SIGN IN ON THE RIGHT. 
    来源
    计算概论05

    思路:

      大模拟;

    来,上代码:

    #include<cstdio>
    #include<string>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    
    using namespace std;
    
    int len;
    
    char word[150];
    
    inline char char_(char char__)
    {
        if(char__>='a'&&char__<='z') char__-=32;
        else if(char__>='A'&&char__<='Z') char__+=32;
        return char__;
    }
    
    int main()
    {
        gets(word);
        len=strlen(word);
        for(int i=0;i<len;i++) word[i]=char_(word[i]);
        puts(word);
        cout<<endl;
        return 0;
    }
  • 相关阅读:
    Shell 字符串
    shell 使用变量
    shell 数组
    shell 注释
    shell 输出双引号
    shell wc命令 统计行数
    shell :
    shell 函数调用
    pyqt 调用颜色选择器
    Navicat+Premium+12+破解补丁
  • 原文地址:https://www.cnblogs.com/IUUUUUUUskyyy/p/6104642.html
Copyright © 2011-2022 走看看