NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
[TOC] ## 运行 <details> <summary>main.cpp</summary> ``` #include <iostream> using namespace std; int main() { cout << "Hello World"; // 输出 Hello World return 0; } ``` </details> <br/> 运行 ``` $ g++ hello.cpp $ ./a.out Hello World ``` ## 函数等声明 实现在 main前无需声明 在main 后在需要在main前进行声明 无需声明 <details> <summary>main.cpp</summary> ``` #include <iostream> void demo() { std::cout<< "asd"; } int main() { demo(); return 0; } ``` 需要声明 </details> <br/> <details> <summary>main.cpp</summary> ``` #include <iostream> // 声明 void demo(); int main() { demo(); return 0; } void demo() { std::cout<< "asd"; } ``` </details> <br/>