首页
社区
课程
招聘
[旧帖] [分享]一个小小的cm 0.00雪花
发表于: 2011-9-25 12:51 1390

[旧帖] [分享]一个小小的cm 0.00雪花

2011-9-25 12:51
1390
收藏
免费 0
支持
分享
最新回复 (5)
雪    币: 308
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
支持一个,
2011-9-25 13:06
0
雪    币: 695
活跃值: (25)
能力值: ( LV9,RANK:170 )
在线值:
发帖
回帖
粉丝
3
nerin
GllMG
2011-9-25 14:53
0
雪    币: 622
活跃值: (294)
能力值: ( LV13,RANK:410 )
在线值:
发帖
回帖
粉丝
4
差不多这样了吧。
由于程序是DEBUG模式编译的。所以代码就按DEBUG来写了,实际上还是可以优化的……
char switchChar(char ch)
{
	char result;
	char a[]="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	char b[]="NOeTdRiosNFzKWkxZYbwnpnjCmrvqVfkgLBhGIDQlIWJMzErxGkSBlyXH[3FAj";
	int i=0;
	while (a[i]!=ch)
	{
		i++;	
	}
	result=b[i];
	retn result;
}

void main()
{
	char str_username[30]={0};
	int str_username_len;
	char str_usercode[30]={0};
	Label1:
	printf "\n用户名不得小于5个字符";
	printf "\n\n\n请输入用户名:";
	scanf "%s",str_username;
	str_username_len = lstrlen(str_username);
	if (str_username_len<5 || str_username_len>=30)
	{
		printf "\n\n\n用户名字数不在指定的范围内";
		sleep(1000);
		system("cls");
		goto Label1;
	}
	system("cls");
	printf "\n用户名不得小于5个字符";
	printf "\n\n\n请输入用户名:%s",str_username;
	printf "\n用户码:";
	scanf "%s",str_usercode;
	char swithed_username[30]={0};
	for (int index=0;index<=str_username_len;index++)
	{
		char ch=*(str_username+index);
		ch = switchChar(ch);
		switched_username[index]=ch;
	}
	int successCount=0;
	for (int index=0;index<=str_username_len;index++)
	{
		if (switched_username[index]==*(str_username+index) successCount++;
	}
	(successCount==str_username_len)?printf"\n密码正确\n":printf"\n密码错误\n";
	sleep(1000);
	system("cls");
}
2011-9-25 16:20
0
雪    币: 19
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
怎么弄的呀
2011-9-25 17:08
0
雪    币: 64
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
学习学习
努力成为会员
2011-9-26 08:48
0
游客
登录 | 注册 方可回帖
返回
//