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

Re:C++ (用cin.ignore解决疑难问题)

Posted by 200530501412 at 2007-03-17 21:09:32 on Problem 1298
In Reply To:C++ (用cin.ignore解决疑难问题) Posted by:wcfairytale at 2007-02-28 14:04:32
//我的solution
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string input;
	char array[26]={'V','W','X','Y','Z','A','B','C','D','E','F',
					'G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U'};
	unsigned int i;
	int index;
	while(1)
	{
		getline(cin,input);
		if(input=="ENDOFINPUT")//end of input
			break;
		else if(input=="START"||input=="END")//the start and end
				continue;
		else
			for(i=0;i<input.size();i++)
				if(input[i]>='A'&&input[i]<='Z')
				{
					index=input[i]-'A';
					input[i]=array[index];//xlat查表
				}
		cout<<input<<endl;
	}
	return 0;
}


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