张凌枫 <2016.11.27> 【连续第11天总结】
A.今日任务
1.复习复习复习
2.用户登录界面
3.考高数
B.具体任务
1.考了高数感觉身体被掏空啊
2.用户登录界面增加了判断账户和密码长度的功能
3.发现了注释的用处(果然还是需要注释才知道自己写的都是些什么鬼啊)
4.去计协听讲座(然后听不懂)
5.分号啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!
附代码:
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
class User
{
public:
User(string name = "", string password = "");
string get_name()
{
return m_strName;
}
string get_password()
{
return m_strPassword;
}
void set_name(string name)
{
m_strName = name;
}
void set_password(string password)
{
m_strPassword = password;
}
~User();
private:
string m_strName;
string m_strPassword;
};
User::User(string name, string password)
{
m_strName = name;
m_strPassword = password;
}
User::~User()
{
}
int main()
{
string name, password;
User *user1 = new User("你猜我是不是账户名", "你猜我是不是密码");
cout << "+++++++++++++++ Hello World +++++++++++++++" << endl << endl << endl;//这个是美化
while (1)//是否修改密码判断循环
{
while (1)//用户名输入和判断长度循环
{
cout << "请输入账户:";
cin >> name;
if (name.size() < 4) cout << "朋友你的账户太短了哦!" << endl << endl;
else if (name.size() > 16)cout << "朋友你的密码太长了哦!" << endl << endl;
else if (name.size() <= 16 && name.size() >= 4)
{
break;
}
}
while (1)//密码确认判断循环
{
while (1)//用户密码输入和判断长度循环
{
cout << "请输入密码:";
cin >> password;
if (password.size() > 17)cout << "朋友你的密码太长了哦!" << endl << endl;
else if (password.size() < 6)cout << "朋友你的密码太短了哦!" << endl << endl;
else if (password.size() <= 17 && password.size() >= 6)
{
break;
}
}
user1->set_name(name);
user1->set_password(password);
cout << endl << endl << endl;//这个是美化
cout << "请确认您的用户名:" << user1->get_name() << endl << "请确认您的密码:" << user1->get_password() << endl;
cout << endl << endl << endl << endl;//这个是美化
cout << "请再次输入密码:";
string y;
cin >> y;
if (y == password)
{
break;
}
else if (y != password)
{
}
system("cls");
cout << "+++++++++++++++ Hello World +++++++++++++++" << endl << endl << endl;//这个是美化
cout << endl << endl << endl;//这个是美化
cout << "你的用户名:" << user1->get_name() << endl;
}
cout << "是否修改密码?? 输入 Y 并回车可重新设置 输入 N 并回车即保存账户信息" << endl;
cout << endl << endl << endl << endl;//这个是美化
cout << "+++++++++++++++ Hello World +++++++++++++++" << endl;//这个是美化
char x;
cin >> x;
if (x == 'Y' || x == 'y')
{
}
else if (x == 'N' || x == 'n')
{
break;
}
}
system("pause");
return 0;
}
明日任务:
1.复习复习复习
2.用户登录界面(增加判断密码复杂程度的功能)
3.深拷贝浅拷贝练习