error: cannot convert ‘std::__cxx11::string {aka std::__cxx11::basic_string}’ to ‘float’

最近在調試一個c++代碼,遇到了一個函數中須要返回一個數值,可是這個數值的類型是string型,個人函數是int型,因此這裏就出現了標題的錯誤,通過改進成功解決,代碼以下: 錯誤代碼片斷c++ int get_dep() { string strFrameNo1; int dep; ss>>strFrameNo1; dep=(int)strFrameNo1; return dep; } 改進後的代
相關文章
相關標籤/搜索