Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

嗯,真的疯了,,,谁告诉我这段代码错在哪里了,,,很短的代码,,来看看吧

Posted by yy17yy at 2010-08-17 21:05:43 on Problem 1028
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator