30种编程语言来打印"国庆节快乐":
分别为:
- Python
- JavaScript
- Java
- C
- C++
- C#
- PHP
- Ruby
- Swift
- Go
- Rust
- Kotlin
- Scala
- Perl
- R
- Lua
- Dart
- TypeScript
- Bash (Shell)
- F#
- Julia
- Elixir
- Haskell
- Groovy
- Visual Basic .NET
- MATLAB
- PowerShell
- SQL
- VBA (Visual Basic for Applications)
- COBOL
这些语言覆盖了多种编程范式和应用场景,从脚本语言到系统级编程语言,以及用于特定领域的语言。
- Python
python
print("国庆节快乐")
- JavaScript
javascript
console.log("国庆节快乐");
- Java
java
public class Main {
public static void main(String[] args) {
System.out.println("国庆节快乐");
}
}
- C
c
#include <stdio.h>
int main() {
printf("国庆节快乐\n");
return 0;
}
- C++
cpp
#include <iostream>
int main() {
std::cout << "国庆节快乐" << std::endl;
return 0;
}
- C#
csharp
using System;
class Program {
static void Main() {
Console.WriteLine("国庆节快乐");
}
}
- PHP
php
<?php
echo "国庆节快乐";
?>
- Ruby
ruby
puts "国庆节快乐"
- Swift
swift
import Swift
print("国庆节快乐")
- Go
go
package main
import "fmt"
func main() {
fmt.Println("国庆节快乐")
}
- Rust
rust
fn main() {
println!("国庆节快乐");
}
- Kotlin
kotlin
fun main() {
println("国庆节快乐")
}
- Scala
scala
object HelloWorld extends App {
println("国庆节快乐")
}
- Perl
perl
print "国庆节快乐\n";
- R
r
cat("国庆节快乐\n")
- Lua
lua
print("国庆节快乐")
- Dart
dart
void main() {
print("国庆节快乐");
}
- TypeScript
typescript
console.log("国庆节快乐");
- Bash (Shell)
bash
echo "国庆节快乐"
- F#
fsharp
printfn "国庆节快乐"
- Julia
julia
println("国庆节快乐")
- Elixir
elixir
IO.puts "国庆节快乐"
- Haskell
haskell
main = putStrLn "国庆节快乐"
- Groovy
groovy
println "国庆节快乐"
- Visual Basic .NET
vb
Module Module1
Sub Main()
Console.WriteLine("国庆节快乐")
End Sub
End Module
- MATLAB
matlab
disp('国庆节快乐')
- PowerShell
powershell
Write-Host "国庆节快乐"
- SQL (在SQL中,这通常是在查询结果中显示文本)
sql
SELECT '国庆节快乐' AS Message;
- VBA (Visual Basic for Applications, 例如在Excel宏中)
vba
Sub PrintMessage()
Debug.Print "国庆节快乐"
End Sub
- COBOL
cobol
IDENTIFICATION DIVISION.
PROGRAM-ID. Hello-World.
PROCEDURE DIVISION.
DISPLAY '国庆节快乐'.
STOP RUN.
每一种语言都有其特有的语法和方式来输出文本到控制台。那么?
有你会的那一种么?