2016/10/6
来源:互联网 发布:手机怎么成为网络歌手 编辑:程序博客网 时间:2024/06/11 06:11
1631-5 黄加勉 <2016.10.6>
"连续第5天总结"
namespace A. //今日任务
{
1.类和对象(40%)
2.字符串(50%)
}
namespace B. //具体内容
{
1.感觉类和结构体有点类似
2.现在封装才开一点头,感觉接下来会很高端…
3.vs的字符串头文件是<string>,用<cstring>没法通过
4.getchar();为啥有事有用有时不管用???
5.写了个注册登录的程序…
附上代码:
#include <string>
#include <Windows.h>
using namespace std;
class Register
{
public:
string user_name;
string password1;
string password2;
string code_objective;
string code_subjective;
};
class Login
{
public:
string user_name;
string password;
};
int main()
{
system("color F0");
while (1)
{
int num, time = 0, coor = 0;
bool temp = false, val = true, flag = true;
Register user1;
cout << " \
注册" << endl;
cout << "用户名 : ";
cin >> user1.user_name;
cout << "密码 : ";
cin >> user1.password1;
num = user1.password1.size();
int first = (int)user1.password1[0];
if (first >= 0x41 && first <= 0x5A)
{
cout << "请再输入一遍密码 : ";
cin >> user1.password2;
cout << endl;
if (user1.password1 == user1.password2)
{
temp = true;
}
else
{
cout << "-----------[两次密码输入不一致]-----------" << endl << endl;
cout << "****************请按回车键重新填写****************" <<
endl << endl << endl << endl;
system("pause");
system("cls");
temp = false;
}
if (temp)
{
if (num < 6)
{
cout << "-----------[密码不得小于6位]-----------" << endl;
temp = true;
}
if (num >= 6 && num <= 10)
{
cout << "[密码强度:弱]" << endl;
coor = 1;
temp = false;
}
if (num >= 11 && num <= 15)
{
cout << "[密码强度:中]" << endl;
coor = 2;
temp = false;
}
if (num >= 16 && num <= 20)
{
cout << "[密码强度:强]" << endl;
coor = 3;
temp = false;
}
if (num >= 21)
{
cout << "-----------[密码不得超过20位]-----------" << endl;
temp = true;
}
cout << endl;
if (temp == true)
{
cout << "****************请按回车键重新填写****************" << endl
<< endl << endl << endl;
system("pause");
system("cls");
}
if (temp == false)
{
while (flag && time != 5)
{
user1.code_objective = "45DF2";
cout << "验证码:" << user1.code_objective << endl;
cout << "请输入验证码(有五次机会):";
cin >> user1.code_subjective;
if (user1.code_subjective == user1.code_objective)
{
flag = false;
cout << endl << endl << "<<<<< 注册成功! >>>>>" << endl << " 回车提交注册表格" << endl << endl;
system("pause");
while (val)
{
system("cls");
Login *login = new Login();
if (NULL == login)
{
cout << "*****ERROR*****";
}
else
{
cout << " \
登录" << endl;
cout << "用户名 : ";
cin >> login->user_name;
cout << "密码 : ";
cin >> login->password;
if ((login->user_name == user1.user_name) && (login->password == user1.password1))
{
cout << endl;
cout << "<<<<< 登录成功 ! >>>>>>" << endl;
Sleep(2500);
val = false;
system("cls");
}
else
{
cout << "用户名或密码输入错误" << endl;
system("pause");
val = true;
}
}
delete login;
login = NULL;
}
}
else
{
system("cls");
cout << " \
注册" << endl;
cout << "用户名 : " << user1.user_name << endl;
cout << "密码 : " << user1.password1 << endl;
cout << "请再输入一遍密码 : " << user1.password1 << endl << endl;
switch (coor)
{
case 1: cout << "[密码强度:弱]" << endl; break;
case 2: cout << "[密码强度:中]" << endl; break;
case 3: cout << "[密码强度:强]" << endl; break;
}
time++;
cout << endl << "************验证码输入错误 " << time << "次" << "************" << endl << endl;
if (time == 5)
{
cout << "******请重新填写******" << endl;
Sleep(2000);
}
}
}
system("cls");
}
}
}
else
{
cout << endl << " 密码第一位必须为大写字母 " << endl << endl;
cout << "****************请按回车键重新填写****************" <<
endl << endl << endl << endl;
system("pause");
system("cls");
}
}
return 0;
}
namespace C. //明日任务
{
1.弄懂怎么产生随机字符串
2.字符串和类继续学习
}
0 0
- CVPR 2016-10-6
- 2016/10/6
- 2016年6月10号
- 2016年6月7日 10:42:32
- duilib第四天 2016年6月10日
- Java Web开发笔记(2016-5-6 11:13、2016-5-10 11:13、2016-5-12 14:58)
- 1622-5 孔富晨 总结《2016年10月6日》 【连续第6天总结】
- 2016-6-6
- 2016-6-6
- CVPR 2016-10-10
- 2016-10-10
- 2016/10/10
- hdu 5802 Windows 10(2016 Multi-University Training Contest 6——贪心+dfs)
- (HDU 5802)2016 Multi-University Training Contest 6 Windows 10 (贪心)
- 1613-3-傅溥衍 总结《2016年10月6日》【连续第六天总结】
- 1508-张晨曦总结《2016年-10月-27日》【连续6天总结】
- 2016年上半年信息系统项目管理师真题之上午题小虎趣味解答第6-10题
- 2016/10/01,2016/10/02
- 剑指Offer 23题 从上往下打印二叉树 Java版
- oracle分页查询
- 小白日记25:kali渗透测试之提权(五)--利用配置不当提权
- windows 7下GPT所识别的GUID
- scala筑基篇-03-for表达式
- 2016/10/6
- Android简单实现列表菜单--PopupMenu的简单使用。
- 什么是数据结构和算法
- dom4j解析xml
- VMWare workstation之网络环境搭建
- ovs的netdev, ofproto以及dpif etc.
- java jdk1.8安装问题,若修改安装路径,则找不到\lib\tools.jar
- Hihocoder1388 2016年北京网络赛 FFT
- C++ I/O复用实现聊天室程序