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 ecos at 2007-06-26 14:19:26 on Problem 2872
#include <iostream>
#include <set> 
#include <string>
#include <vector>
using namespace std;
void main()
{
	set<string> dics;
	int num;
	cin>>num;
	int i;
	for ( i = 0 ; i < num; i ++ )
	{
		string name;
		cin>>name;
		dics.insert(name);
	}
	cin>>num;
	for ( i = 0 ; i < num; i++ )
	{
		vector<string> errorWord;
		string word;
		cin>>word;
		while ( word.compare("-1") != 0 )
		{
			set<string>::iterator itor = dics.find(word);
			if ( itor == dics.end())
			{
				errorWord.push_back(word);
			}
			cin>>word;
		}
		if ( errorWord.empty())
		{
			printf("Email %d is spelled correctly.\n",i + 1);
		}
		else
		{
			printf("Email %d is not spelled correctly.\n",i + 1);
			for ( vector<string>::iterator itor = errorWord.begin();
				itor != errorWord.end(); itor ++ )
				{
					cout<<*itor<<endl;
				}
		}
		cout<<"End of Output"<<endl;
	}
}

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