Unverified Commit cf1a5561 authored by 邢家朋's avatar 邢家朋 Committed by GitHub
Browse files

Merge pull request #2 from xingjiapeng/xingjiapeng-patch-1

Update helloworld.md
parents 2d9aaea6 c4da0455
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -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 函数
}
```