#39462: C, C++, python語言詳解


tonypan90913@gmail.com (pan Tony)

學校 : 新北市立新莊高級中學
編號 : 259487
來源 : [210.71.71.202]
最後登入時間 :
2024-05-03 16:29:00
a001. 哈囉 -- Brian Kernighan | From: [203.73.245.178] | 發表日期 : 2024-02-24 18:01

C:

先引入標準函式庫<stdio.h>

再宣告char 變數名[bytes];(string)

用 printf function 印出(格式化字串%s)

不要漏了分號

C++:

引入<iostream>

看要不要用using namespace std;

用的話就不用 (std::)cout,cin;

宣告 string 變數名;

<string>的標準函式庫有很多方法可以用

getuserinput cin ...;

輸出cout ...;

<>代表標準函式庫, ""代表子目錄下的標頭檔;

tree, cd 確認目錄位置

python:

極度簡單, 直譯器語言, 不用宣告類型可自行判斷, 但習慣還是宣告一下自訂函式回傳類型def say() ->None (bool, int, str, tuple[type], list[type]...set, dict)

變數名 = input() -> str取得使用者輸入(有進階方法, 不細講)

print(f"hello, {變數名}") (新版有f字元可以用 舊版用format()...)

 

 

 

 

 

 
ZeroJudge Forum