/******************************************* 以下的西程式(C Program)非常簡單, 由第一個開始看! *******************************************/ /* this is a comment */ /*** To compile/link on SUN: cc file.c -lm then, the file "a.out" will be ready to run if your program is correct. So, simply type "a.out" to execute your program. (注意:因為用到數學函數, 所以上面的 "-lm" 是不能省的!) (阿再注意: 是小寫L 再小寫M喔) On PC, you can use Borland C++/Turbo C++. They are more friendly than MicroSoft C/C++ and other compilers, especially for new users. *****************************************/ #include /*這意思是說到系統某處去抄stdio.h的內容到此處*/ #include /*到系統某處去抄math.h檔案的內容到此處*/ int main() /*每個C程式都嘛叫做main, 不過如果你多懂一點系統的東東, */ { /*你會發現如果你高興也可以把"main"改成別的**************/ printf("Hey you\n"); /* "雙引號夾著叫字串(string)" */ printf(" SQRT(2.0)="); printf("%f",sqrt(2.0)); printf("\n"); printf(" SQRT(3.0)=%f\n",sqrt(3.0)); printf("see the point?\n"); printf(" SQRT(3)=%f\n",sqrt(3)); printf("不用奇怪! 因為標準函數sqrt的參數應該為double(倍準實數)!\n"); printf("阿所以你傳給它整數阿就有問題嘍!\n"); return 0; }