C/C++的问题。不懂啊。为什么会错?

[复制链接]
查看11 | 回复2 | 2012-5-1 12:28:03 | 显示全部楼层 |阅读模式
给改好了#include#include#includeusing namespace std;int main (){vector spvec;cout > str) {string *pstr = new string;*pstr = str;spvec.push_back(pstr);}vector::iterator iter;fo...
回复

使用道具 举报

千问 | 2012-5-1 12:28:03 | 显示全部楼层
优先级问题, "->的优先级比"*"的高*iter -> size()相当于 *(iter->size())所以要加括号 (*iter)->size()...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行