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 lbb10_16 at 2009-09-15 17:26:42 on Problem 2141
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	char key[27], string[81];
	int i, l;
	scanf("%s", key);
	getchar();
	gets(string);
	l = strlen(string);
	string[0] = key[string[0] + 32 - 'a'] - 32;
	for (i = 1; i < l; i++)
	{
		if(string[i] >= 'a' && string[i] <= 'z')
			string[i] = key[string[i] - 'a'];
		else 
			if (string[i] >= 'A' && string[i] <= 'Z')
				string[i] = key[string[i] + 32 - 'a'];
	}
	printf("%s", string);
	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