Mac下的第乙個C 程式 HelloWorld

2021-07-25 07:57:19 字數 562 閱讀 3978

在windows下習慣了vs編寫c++程式,當然也用命令列編譯過程式,在mac下沒有裝ide的情況下,使用終端編寫好了helloworld.cpp檔案之後,不知道如何在mac下編譯,使用了gcc命令報錯了,已寫過helloworld.c檔案,gcc編譯執行都沒問題。查了一下,在mac下編譯c++程式可以使用clang++或g++,我兩個都試了一下,都可用。

#include

using

namespace

std;

int main()

# 編譯

$ clang++ -o helloworld

helloworld.cpp

# 執行

$ ./helloworld

hello world!

# 編譯

$ g++ -o helloworld

helloworld.cpp

# 執行

$ ./helloworld

hello world!

Code Blocks下的第乙個C 程式

main.cpp include include using namespace std class test cout input your name name 下面是不用異常處理方法做的。注意裡面的continue,其實這是針對上面cin id寫的。if cin.fail 筆記 1.注意函式ci...

ubuntu下的第乙個C 程式

按照2019年的計畫,開始進行c 的學習,c的學習真的不知道自己到了什麼程度,需要在學習c 的同時進一步深化,c 是很難的一門語言,需要有毅力的人堅持下去,學習c 的兩個目的 1 進一步學習c。2 學習qt圖形化介面開發,c 給自己兩個月的時間去學習,在這兩個月需要把c 的基本語法搞通,據說,c 的...

第乙個C 程式

include using namespace std 宣告函式 void dosomething int start,int length,int center,bool order 入口 int main start 開始字元 length 字元長度 center 中間字元 order 順序還是...