原文:no suitable ctr exists to convert from 'int' to 'std::basic_string ,std::allocator >

View Code 以上代碼可討論幾個問題,記錄在下面。這段代碼的功能是找出數組中的最大值,用x記錄比較過程,x初始為a ,從第二個元素開始比較,比x大,x值就更新,遍歷完數組,x就是最大的。 std::string編譯器是不認識的,只認識int,float,int 等類型,string在編譯器里的類型是std::basic string lt char,std::char traits lt ...

2017-10-15 00:36 0 2993 推薦指數:

查看詳情

convert between char* and std::string

char* to std::string   std::string has a constructor for this:    note: Make sure thar your char* isn't NULL, or else the behavior ...

Wed Jun 27 15:46:00 CST 2012 0 3071
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM