Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
嗯,真的疯了,,,谁告诉我这段代码错在哪里了,,,很短的代码,,来看看吧#include <iostream> #include <vector> using namespace std; void main() { vector<char*>a; a.push_back("a"); char temp[100]; while(cin>>temp) { a.push_back(temp); for(int j=0;j<a.size();j++) cout<<a[j]<<endl; } } /* b c */ b和c是测试数据 b没有问题,,输出 a b 但是到c的时候就输出 a c c 把b给弄没了,,没搞明白怎么没的,,, 本来是用vector<string>来做这个破题的,,结果编译器不让用,waning,,不会解决(VC6),,然后改vector<char*>然后怎么调怎么不对,,,郁闷死了,,哪位大哥解释一下啊,, Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator