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 766164170 at 2010-11-08 19:58:46 on Problem 2538
#include <stdio.h>

char l1[]="`1234567890-=",l2[]="QWERTYUIOP[]",l3[]="ASDFGHJKL;'",l4[]="ZXCVBNM,./";
char str[100];
int i,j;
int main()
{
	while(1)
	{
		if(!gets(str))
			break;
		for(i=0;str[i]!='\0';i++)
		{
			for(j=0;l1[j]!='\0';j++)
			{
				if(l1[j]==str[i])
				{
					printf("%c",l1[j-1]);
					break;
				}
			}
			for(j=0;l2[j]!='\0';j++)
			{
				if(l2[j]==str[i])
				{
					printf("%c",l2[j-1]);
					break;
				}
			}
			for(j=0;l3[j]!='\0';j++)
			{
				if(l3[j]==str[i])
				{
					printf("%c",l3[j-1]);
					break;
				}
			}
			for(j=0;l4[j]!='\0';j++)
			{
				if(l4[j]==str[i])
				{
					printf("%c",l4[j-1]);
					break;
				}
			}
			if(str[i]==' ')
				printf("%c",' ');
		}
	}
	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