記錄

見證自己的成長
8.5 像個傻子一樣重新開始

今天遇到的問題
1、int 32位, short int = int;
2、出現這個警告

warning: format '%d' expects argument of type 'int*', but argument 2 has type 'int' [-Wformat=]

是因爲 scanf 裏沒有加 & (好多年沒敲C,但是這個還是得記得)
3、出現這個錯誤

error: cannot pass objects of non-trivially-copyable type 'std::string {aka class std::basic_string<char>}' through '...'|

是因爲%s只能用於C裏的輸出,所以要把C++ String 轉化成C string

string s = "ILoveYou";
s.c_str();

感謝此篇博文

4、數字和字符串的轉化,簡潔明瞭,一目瞭然
感謝此篇博文

5、寫題寫的入了魂了,加油吧,甲級不是那麼好過的哈哈

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章