編寫一個hello world的程序是學習C++最基本的。下面給出幾種用C++編寫hello world的方法:
方法1:
#include <iostream> using namespace std; int main() { cout << "Hello World!"; return 0; }
方法二:
#include <stdio.h> int main() { printf("Hello World!"); return 0; }
方法三:
#include <cstdio> #define saySomething(sth) puts(#sth) int main() { return saySomething(Hello world); }
回答所涉及的環境:聯想天逸510S、Windows 10。
編寫一個hello world的程序是學習C++最基本的。下面給出幾種用C++編寫hello world的方法:
方法1:
方法二:
方法三:
回答所涉及的環境:聯想天逸510S、Windows 10。