c++用户登录注册系统.doc

上传人:文库蛋蛋多 文档编号:2384408 上传时间:2023-02-17 格式:DOC 页数:5 大小:15KB
返回 下载 相关 举报
c++用户登录注册系统.doc_第1页
第1页 / 共5页
c++用户登录注册系统.doc_第2页
第2页 / 共5页
c++用户登录注册系统.doc_第3页
第3页 / 共5页
c++用户登录注册系统.doc_第4页
第4页 / 共5页
c++用户登录注册系统.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《c++用户登录注册系统.doc》由会员分享,可在线阅读,更多相关《c++用户登录注册系统.doc(5页珍藏版)》请在三一办公上搜索。

1、用户登录注册#include stdafx.h#include iostream#include string#include stdlib.h#include string#include conio.h#include fstream#include windows.husing namespace std;struct userstring name;string password;void nterface(user custum);int main()void login();void regist();int options;cout endl endl endl endl;cou

2、t 1.登录 endl;cout 2.注册 endl;cout (请输入选项并按回车) endl;cout options;while (options!=1&options!=2)cout options; cout options;if (options =1)system(CLS);login();if (options = 2)system(CLS);regist();system(CLS);login();return 0;void login()string name;char *password = new char20;cout endl endl endl endl endl

3、;cout name;cout 0)cout test test;passwordi- = 0;elseif (i 20)cout *;passwordi = test;i+;passwordi = 0;ifstream fin;fin.open(user.txt,ios_base:in);if (fin.fail()cout 打开文件失败 custumer.name custumer.password)if (custumer.name = name&custumer.password = password)cout 登录成功! custumer.name custumer.password

4、)elsecoutendl 用户名或密码错误! endl;Sleep(3000);system(CLS);login();void regist()string name;char *password = new char20;cout endl endl endl endl endl;ifstream fin;fin.open(user.txt, ios_base:in);user custumer;int i = 0;cout name;while (fin custumer.name custumer.password)if (custumer.name = name) i+;if (i

5、 0)cout 该用户名已被注册! endl; regist();cout 0)cout test test;passwordi- = 0;elseif (i 20)cout *;passwordi = test;i+;passwordi = 0;cout 0)cout test test;password2i- = 0;elseif (i 20)cout *;password2i = test;i+;password2i = 0;if (strcmp(password,password2)!=0)cout endl 两次输入密码不一致,请重新注册。 endl;Sleep(3000);system(CLS);regist();elsecoutendl 注册成功!撸一发庆祝一下;ofstream fout;fout.open(user.txt,ios_base:out|ios_base:app);fout name password endl;fout.close();coutendl 3秒后跳到登录界面.;Sleep(3000);void nterface(user custum)system(CLS);cout 您好!custum.name endlendl;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号