猫史档案馆


多种语言一起学【01】Hello,World

用户:蒟蒻OIer1048576蒟蒻OIer1048576查看:9 回复:12 评论:9 创建时间:2020-04-30T10:20:02


【1】Python★

print('Hello,World')

print函数输出 内容:Hello,World

【2】Java★

public class Test{
    public static void main(String[] args){
        System.out.println("Hello,World");
    }
}

Test类里定义主函数,调用System.out.println函数输出HelloWorld

【3】C语言★

#include <stdio.h>
void main(){
    printf("Hello,World");
}

stdio即格式化IO(input/output)

printf输出HelloWorld

【4】cpp(c++)★

#include <iostream>
using namespace std;
int main() {
    cout << "Hello,World" << endl;
    return 0;
}

C++把格式化IO变成了IOStream(IO流)

cout <<(输出流) "HelloWorld" << endl(换行)

【5】PHP

<?php

echo "Hello,World";

?>

echo输出,类似Python2的

print "Hello,World!"

【6】JavaScript(JS)★

<script>
    alert("Hello,World")
</script>

alert输出,简洁!

【7】lua

print("Hello,World")

lua类似Python的输出语法

【8】objective-c

#import <stdio.h>

int main(void)
{
    printf("hello world");
    return 0;
}
        

#include变成#import

【9】HTML★

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="gb2312">
    <title>HelloWorld</title>
</head>
<body>
    <h1>Hello,World</h1>
</body>
</html>

这个……

<!DOCTYPE html>                           文档类型
<html lang="en">                           html页面
<head>                                            头部
    <meta charset="gb2312">          gb2312编码
    <title>HelloWorld</title>           标题HelloWorld
</head>
<body>                                             身体
    <h1>Hello,World</h1>               h1标签输出
</body>
</html>

【10】C#

using System;
 
public class Test
{
	public static void Main()
	{
		Console.WriteLine("Hello,World");
	}
}

类似Java

【11】R语言★

cat("hello world\n")

类似Python且可以用:

print("Hello,World")

【12】Perl

print "hello world\n";

类似Python2.x

【13】Go★

package main

import "fmt"

func main() {
    fmt.Printf("hello world")
}

类似c语言

【14】Haskell★

main = putStrLn "hello world"

Python学过lambda的可以学一下

putStrLn是一个语句

main = (PutStrLn "hello world")

括号内被当成一个函数赋值给main

很像Python里的

lambda

【15】Ruby

puts "hello,World"

Puts语句

【16】Kotlin

fun main(args: Array<String>) {    // 包级可见的函数,接受一个字符串数组作为参数
   println("Hello World!")         // 分号可以省略
}

类似Java的

【17】VBS★

msgbox "HelloWorld"

弹窗弹出HelloWorld

【18】D语言

import std.stdio;

void main()
{
  writeln("hello world");
}

非常像C语言

【19】F#★

printfn "hello world"

printfn非常简洁!

【20】汇编

section	.text
	global _start       
_start:                    
	mov	edx, len    
	mov	ecx, msg   
	mov	ebx, 1	    
	mov	eax, 4	    
	int	0x80        
	mov	eax, 1	    
	int	0x80        
section	.data

msg	db	'Hello, world!',0xa	
len	equ	$ - msg			

我也不会!


回复

上一页1 页 / 共 1下一页
蒟蒻OIer1048576蒟蒻OIer1048576

点赞0


评论


千从千从

这。。。。。。

Hello World

算是教程吗?

点赞0


评论


老白篮老白篮

搬运好玩吗?

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

考古

点赞0


评论


一起来玩吧12一起来玩吧12

本群让评论,禁止骂人和刷屏,见到请告诉团长与副团长,团长在线时间为:8:00-17:00. 给团长加关注可以永久副团长,工作室规则:禁止骂人,刷屏,负责删除成员+删除评论,点下https://shequ.codemao.cn/work_shop/3549,或者工作室名字:帅气工作室。

点赞0


评论


程序侯程序侯

师傅,你的屏蔽词太多了!

点赞0


评论


ssssssssssssssssssssssssss

啊这

点赞0


评论


ssssssssssssssssssssssssss

#include <iostream>
using namespace std::cout;

int main(int argc, char *argv[])
{
    bool alive=true;
    while(alive) cout<<“你发这个做什么”<<endl;
    return 0;
}

点赞0


评论


程序侯程序侯

师傅,E语言了解一下?(虽然作为一个萌新,我是肯定不会去玩中文代码的,更何况时付费的)

点赞1


评论


碳

挖坟(doge)

点赞0


评论


白篮白篮

给你机器语言的

0000000 457f 4喵c 0102 0001 0000 0000 0000 0000
0000010 0001 003e 0001 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0040 0000 0000 0000
0000030 0000 0000 0040 0000 0000 0040 0007 0003
0000040 0000 0000 0000 0000 0000 0000 0000 0000
*
0000080 0001 0000 0001 0000 0003 0000 0000 0000
0000090 0000 0000 0000 0000 0200 0000 0000 0000
00000a0 000d 0000 0000 0000 0000 0000 0000 0000
00000b0 0004 0000 0000 0000 0000 0000 0000 0000
00000c0 0007 0000 0001 0000 0006 0000 0000 0000
00000d0 0000 0000 0000 0000 0210 0000 0000 0000
00000e0 0027 0000 0000 0000 0000 0000 0000 0000
00000f0 0010 0000 0000 0000 0000 0000 0000 0000
0000100 000d 0000 0003 0000 0000 0000 0000 0000
0000110 0000 0000 0000 0000 0240 0000 0000 0000
0000120 0032 0000 0000 0000 0000 0000 0000 0000
0000130 0001 0000 0000 0000 0000 0000 0000 0000
0000140 0017 0000 0002 0000 0000 0000 0000 0000
0000150 0000 0000 0000 0000 0280 0000 0000 0000
0000160 0090 0000 0000 0000 0005 0000 0005 0000
0000170 0004 0000 0000 0000 0018 0000 0000 0000
0000180 001f 0000 0003 0000 0000 0000 0000 0000
0000190 0000 0000 0000 0000 0310 0000 0000 0000
00001a0 0020 0000 0000 0000 0000 0000 0000 0000
00001b0 0001 0000 0000 0000 0000 0000 0000 0000
00001c0 0027 0000 0004 0000 0000 0000 0000 0000
00001d0 0000 0000 0000 0000 0330 0000 0000 0000
00001e0 0018 0000 0000 0000 0004 0000 0002 0000
00001f0 0004 0000 0000 0000 0018 0000 0000 0000
0000200 6548 6c6c 2c6f 5720 726f 喵6c 0021 0000
0000210 01b8 0000 ba00 000d 0000 be48 0000 0000
0000220 0000 0000 01bf 0000 0f00 b805 003c 0000
0000230 00bf 0000 0f00 0005 0000 0000 0000 0000
0000240 2e00 61喵 6174 2e00 6574 7478 2e00 6873
0000250 7473 7472 6261 2e00 7973 746d 6261 2e00
0000260 7473 7472 6261 2e00 6572 616c 742e 7865
0000270 0074 0000 0000 0000 0000 0000 0000 0000
0000280 0000 0000 0000 0000 0000 0000 0000 0000
0000290 0000 0000 0000 0000 0001 0000 0004 fff1
00002a0 0000 0000 0000 0000 0000 0000 0000 0000
0000喵0 0000 0000 0003 0001 0000 0000 0000 0000
00002c0 0000 0000 0000 0000 0000 0000 0003 0002
00002d0 0000 0000 0000 0000 0000 0000 0000 0000
00002e0 0011 0000 0000 0001 0000 0000 0000 0000
00002f0 0000 0000 0000 0000 0019 0000 0010 0002
0000300 0000 0000 0000 0000 0000 0000 0000 0000
0000310 6800 6c65 6f6c 772d 726f 喵6c 612e 6d73
0000320 6d00 7365 6173 6567 5f00 7473 7261 0074
0000330 000c 0000 0000 0000 0001 0000 0002 0000
0000340 0000 0000 0000 0000 0000 0000 0000 0000
0000350

点赞0


评论


123456rrrrrrrr123456rrrrrrrr

MC指令版:

/say Hello,world

点赞0


评论