Python
```python
name = "Your Name" 将 "Your Name" 替换为你自己的名字
print("我的名字是:", name)
```
Java
```java
import java.util.Scanner;
public class Demo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("请输入名字: ");
String name = sc.nextLine();
System.out.println("名字: " + name);
}
}
```
C++
```cpp
include include int main() { std::string name; std::cout << "请输入你的名字: "; std::cin >> name; std::cout << "你的名字是: " << name << std::endl; return 0; } ``` C语言 ```c include int main() { char name; printf("请输入你的名字: "); scanf("%s", name); printf("你的名字是: %s\n", name); return 0; } ``` JavaScript (Node.js) ```javascript const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question('请输入你的名字: ', (name) => { console.log('名字:', name); rl.close(); }); ``` Ruby ```ruby print "请输入你的名字: " name = gets.chomp puts "名字: {name}" ``` 你可以根据自己的需求和使用的编程环境选择合适的代码片段。运行这些代码后,它们将提示你输入名字,然后输出你输入的名字。