0
Follow
0
View

No ideas, provide some ideas.

cxcmvpmtv 注册会员
2023-02-25 19:08

C# implementation, directly using string ToLower() method can

string str = "ABcD".ToLower(); // 大写字母转成小写字母

string str1 = "abcD".ToUpper(); // 小写字母 转成 大写字母
  • Code reference:
using System;
using System.Collections.Generic;
using System.Text;

namespace Demo {
   class MyApplication {
      static void Main(string[] args) {
         string str = Console.ReadLine();
         Console.WriteLine("转换前 : {0}", str);

         Console.WriteLine("转换后 : {0}", str.ToLower());
         Console.ReadLine();
      }
   }
}

zed5801008 注册会员
2023-02-25 19:08

If this is a winform Textbox, it comes with a property: the CharacterCasing for the behavior. Once this is set up, the character input is changed to

.
lsd1957 注册会员
2023-02-25 19:08

Part of the answer references GPT, GPT_Pro better solve the problem

#include 
int main(){
    char c;
    printf("请输入一个大写字母:");
    scanf("%c", &c);
    if (c >= 'A' && c <= 'Z') {
        printf("%c对应的是%c\n", c, c + 32);  // 将大写字母加上32就可以得到对应的小写字母
    } else {
        printf("输入的不是大写字母,请重新输入一个大写字母!\n");
    }
    return 0;
}

In the above code, we first define a variable c of type char, then use the printf function to prompt the user for an uppercase letter, and use the scanf function to store the letter the user entered into the variable c. Then, use the if statement to determine if the user typed an uppercase letter. If so, use the printf function to print the original input with the corresponding lowercase letter. If not, the user is prompted to enter a new uppercase letter. Finally, a return of 0 indicates that the program executed successfully.
If the answer is helpful, please accept it.

lijie43011 注册会员
2023-02-25 19:08

1. First read an uppercase letter from the keyboard using the input() function and store it in the variable uppercase_letter.
2. Then convert uppercase to lowercase using the lower() method of the string object and store the result in the variable lowercase_letter.
3. Finally, use the print() function to print the result. In the output statement, we concatenate multiple strings together using the string "addition" operator. Here we concatenate a string literal, the original uppercase letter, and a string literal to print the prompt.

# 从键盘读入一个大写字母
uppercase_letter = input()

# 将大写字母转换为小写字母
lowercase_letter = uppercase_letter.lower()

# 输出结果
print(uppercase_letter + "对应的是" + lowercase_letter)


About the Author

Question Info

Publish Time
2023-02-25 19:08
Update Time
2023-02-25 19:08

Related Question

AttributeError: 'WindowsPath' object has no attribute 'accessor'

no target connected

电脑图片显示值为None无法用opencv和os调用却可以查看并预览

Django4中能否使用Postgresql的Nosql功能

我在任何点平台交换的API Notebook中没有得到适当的响应

SQL中NOT EXISTS到底是怎么执行程序的?

使用postgresql/snowflake提取json键/值对,其中value不是null/blank

spring boot数据自动填充nosql数据库

Laravel 9可以使用vite.config.js显示libnotify-bin通知吗?

需要后端node代码解释