2016.11.22 封装上总结

张凌枫<2016.11.22>【连续第6天总结】

A.今日任务
1.复习复习复习
2.封装篇上总结复习
3.用户登录界面(30%)

B具体任务
1.把封装上篇又看了一遍
2.做了封装上篇的相关练习
3.用户界面的美化(初步)
4.登陆界面的密码确认判断
5.用户登录时讲究的就是一个好看
6.这样确认密码貌似能少一个参数和一个类
7.判断语句的位置!!! 判断语句的位置!!! 判断语句的位置!!! 判断语句的位置!!!

附代码:

#include <iostream>
#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)
    {

        cout << "请输入账户:";
        cin >> name;

        while (1)
        {
            cout << "请输入密码:";
            cin >> password;

            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')
        {

        }

        else if (x == 'N')
        {
            break;
        }



    }
    system("pause");
    return 0;
}

明日任务:
1.封装下篇开始
2.继续写用户登录界面

博客地址:http://blog.csdn.net/night__day

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值