C 學習第三天

2021-09-06 08:57:25 字數 1187 閱讀 3579

一些基礎就可以略過了,看書不能太呆板。

如果把一本書看完了,剩下的就是在實際專案中進行整合,訓練,然後整理成筆記。

每天敲點程式,記點筆記。

變數作用域

**:

#include #include 

#include

std::

string s1 = "

hello

"; //

全域性int

main()

結果:hello world

42 world

判斷**輸出結果

**:

#include #include 

#include

int i = 42

;int

main()

結果:100 45

用class和struct關鍵字定義類的唯一差別在於預設訪問級別:預設情況下,struct的成員為public,而class的成員為private。

一旦使用了using宣告,我們就可以直接引用名字,而不需要再引用改名字的命名空間了。

結果:the size of the expense of spirit

is22 characters,including the newline

第三天 c 學習

1 void my function const a 常引用 目的是為了使得實參不可以被修改 2 函式過載 函式引數預定義值會產生二義性 3 public 類的內外部都可以被訪問 porivate 只能在類的內部被訪問 protected 用在類的內部 繼承 4 析構 先建立的物件後析構,遵循堆疊原...

C 學習第三天

今天是學習的第三天,主要學習內容如下 1.c 字符集 2.識別符號構成規則 3.c 資料型別 4.轉義字元 5.符號常量 6.基本算數運算子 7.符合算數運算子 寫 抄 了個程式 include 讓程式包含iostream類 using namespace std 開啟命名空間,使用iostream...

C 學習第三天

一些基礎就可以略過了,看書不能太呆板。如果把一本書看完了,剩下的就是在實際專案中進行整合,訓練,然後整理成筆記。每天敲點程式,記點筆記。變數作用域 include include include std string s1 hello 全域性int main 結果 hello world 42 wo...