OSDN Git Service

Update helloworld.md
author邢家朋 <47733616+xingjiapeng@users.noreply.github.com>
Sun, 6 Oct 2019 08:56:56 +0000 (16:56 +0800)
committerGitHub <noreply@github.com>
Sun, 6 Oct 2019 08:56:56 +0000 (16:56 +0800)
docs/lang/helloworld.md

index c9837a3..0beba5d 100644 (file)
@@ -22,7 +22,7 @@ IDE 操作较为简单,一般入门玩家会选用 IDE 来编写代码。在
 xcode-select --install
 ```
 
-#### NOI Linux
+#### Linux
 
 使用 `g++ -v` 来检查是否安装过 `g++` 。
 
@@ -34,10 +34,14 @@ sudo apt update && sudo apt install g++
 
 熟练之后也有玩家会使用更灵活的命令行来编译代码,这样就不依赖 IDE 了,而是使用自己熟悉的文本编辑器编写代码。
 
+g++是C++语言的编译器,C语言的编译器为gcc。
+
 ## 第一行代码
 
 通过这样一个示例程序来展开 C++ 入门之旅吧~
 
+C++语言
+
 ```c++
 #include <cstdio>  // 引用头文件
 
@@ -46,3 +50,25 @@ int main() {                // 定义 main 函数
   return 0;                 // 返回 0,结束 main 函数
 }
 ```
+
+```c++
+#include <iostream>  // 引用头文件
+
+using namespace std;
+
+int main() {                // 定义 main 函数
+  cout << "Hello, world!"  // 输出 Hello, world!
+  return 0;                 // 返回 0,结束 main 函数
+}
+```
+
+C语言
+
+```c
+#include <stdio.h>  // 引用头文件
+
+int main() {                // 定义 main 函数
+  printf("Hello, world!");  // 输出 Hello, world!
+  return 0;                 // 返回 0,结束 main 函数
+}
+```