Nat*_*ath 12

#include<iostream>

int hello() {
    cout<<"Hello World"<<endl;
}

static int foo = hello();

int main(){return 0;}
Run Code Online (Sandbox Code Playgroud)

  • 或者在控制台中运行它,因为它实际上是一个控制台应用程序.系统("暂停")不是标准的. (3认同)

Jar*_*Par 11

只需将此代码添加到某处的.cpp文件即可.

class Hack {
  Hack() { cout << "Hello World"; }
} hackInstance;
Run Code Online (Sandbox Code Playgroud)