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());

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

int main(){
    char c;
    scanf("%c", &c);
    if (c >= 'A' && c <= 'Z') {
        printf("%c对应的是%c\n", c, c + 32);  // 将大写字母加上32就可以得到对应的小写字母
    } else {
    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



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

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


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

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