or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
(´>∀)人(´・ω・)ノヽ(・ε・*)人(-д-`)
Ruby @Sprout 2022
(´>∀)人(´・ω・)ノ日主ヽ(・ε・*)人(-д-`)
Ruby @Sprout 2022
(´>∀)人(´・ω・)ノ今日主題ヽ(・ε・*)人(-д-`)
Ruby @Sprout 2022
人(´・ω・)ノ 今日主題 ヽ(・ε・*)人
Ruby @Sprout 2022
ω・)ノ 今日主題 ヽ(・ε
Ruby @Sprout 2022
)ノ 今日主題 ヽ(
Ruby @Sprout 2022
今日主題
Ruby @Sprout 2022
C++ String & FileIO
Ruby @Sprout 2022
Outline
C-string Review
std::string
Applications of std::string
std::stringstream
FileIO
Applications of FileIO
C-string Review
std::string
Applications of std::string
std::stringstream
FileIO
Applications of FileIO
C-string 的本質
C-string 本質上是
char
陣列C-string Review 1
C-string 的操基本操作
利用
<cstring>
(<string.h>
) 中的函式C-string Review 2
字面常數字串存在哪裡?
是 Stack 嗎?還是 Heap 呢?答案是:都不是!
C-string Review 3-1
C-string Review 3-2
多數 Bug 的根源–未定義行為
因為 C-string 本質是陣列,所以如同其他型態的陣列一樣,超出範圍不一定會報錯,是未定義行為!
C-string Review 4
C-string Review
std::string
Applications of std::string
std::stringstream
FileIO
Applications of FileIO
A peek into
std::string
C++ String 1
C++ String 2
各種「附帶功能」(Methods)
C++ String 3
各種「附帶功能」(Methods)
更多、更詳細的說明文件 (Documentation) 請參考
C++ reference
Any questions?
C-string Review
std::string
Applications of std::string
std::stringstream
FileIO
Applications of FileIO
課堂練習 1
Sprout OJ No. 441
Solution
哈哈不給你看,上課講解!
Any questions?
C-string Review
std::string
Applications of std::string
std::stringstream
FileIO
Applications of FileIO
What is "stream"
Stream ,即「流」。
Reference
ostream
cout
cerr
clog
istream
cin
Sample code
w/o stringstream
w/ stringstram
課堂練習 2
Sprout OJ No. 442
C-string Review
std::string
Applications of std::string
std::stringstream
FileIO
Applications of FileIO
Create (Overwrite) a file
Load an existing file
Load and overwrite an existing file
C-string Review
std::string
Applications of std::string
std::stringstream
FileIO
Applications of FileIO
Loading testcases
Quick Review
感謝參與!