- UID
- 46356
注册时间2008-2-20
阅读权限30
最后登录1970-1-1
龙战于野

TA的每日心情 | 开心 2022-4-1 09:59 |
---|
签到天数: 76 天 [LV.6]常住居民II
|
发表于 2009-5-17 15:38:06
|
显示全部楼层
楼上各位好快呀!嘿嘿
我来晚了,不会加图形界面,大家将就一下:loveliness:
以下代码在VC6.0 SP6下编译通过
- /*Code by TheEnd 20090517*/
- #include <stdio.h>
- #include <string.h>
- #include <iostream.h>
- #include <stdlib.h>
- int main()
- {
- int i, name, RegCode = 0; //经ppt指教,省掉变量temp
- char username[100];
- inputusername:
- cout << "Please input Username: ";
- cin >> username;
- name = strlen(username); //经boy等指点再次优化一下,循环条件外提;
- if (name < 6)
- {
- cout << "The length of Username must >= 6,Please input again!" << endl;
- goto inputusername;
- }
- for (i = 0; i < name; i++) //经boy等指点再次优化一下,循环里尽量不加计算条件;
- {
- RegCode += username[i] * (i + 1) + 256; //经ppt指教,省掉变量temp;
- //RegCode += temp;
- }
- cout << "The code is: " << RegCode << endl;
- system ("Pause");
- //getchar();
- return 0;
- }
复制代码 算法KeyGen:)
[ 本帖最后由 theend 于 2009-5-17 16:28 编辑 ] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入我们
x
|