原文: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