做了个类似与学生管理系统的东西 |
您所在的位置:网站首页 › 类似与相似举例的例子 › 做了个类似与学生管理系统的东西 |
经过一段时间的学习,又有了新的收获刚好有同学找到了我,让我帮他写一个类似与学生管理系统一样的东西,经验有限,所以,不足之处请多多指正,欢迎评论。下面就先贴上源码了 #include #include #include #include #include #include #include using namespace std; struct user { string ID; //身份证 set tel; //手机号 string name; //用户名 string sex; //性别 int age; // 年龄 string phe; //职业 string place; //家庭住址 user *nextuser; }; class SInfo { user *userListHead; public: SInfo(); ~SInfo(); void creat(); //新增用户 user *userFindtel(string tel); //电话查询 user *userFindID(string ID); //身份证查询 int checktel(string tel, user *p); //电话查询 int checktel(string tel); //重载 user *userFindname(string name); //用户名查询 void telin(string ID); // 注册手机号 void telout(string tel); // 注销手机号 void userModify(string name); //修改用户信息 void userDelete(string name); //删除用户信息 void userCopy(user *ptemp, user *p); //用户信息拷贝 void usernameSort(); //用户名排序 void userageSort(); //年龄排序 void userIDSort(); //身份证排序 void userinsert(string ID,string tel,string name,string sex,int age,string phe,string plac); //插入用户信息 void userRead(); //从文件读入学生信息 void userSave(); //保存用户信息到文件 void userQuit(); //安全退出 void ShowInfo(); //输出用户信息 }; //登陆界面 int Systemdoor() { string username = "jiangtao", password = "111111"; string name, temp; int number = 3; while (1) { cout > name; cout > temp; if (name != username || temp != password) { number--; if (number >0) { cout age) { user *ptemp = new user; userCopy(ptemp, p); userCopy(p, q); userCopy(q, ptemp); } } } void SInfo::userinsert(string ID,string tel,string name,string sex,int age,string phe,string place) { user *s,*p; s = new user; s->ID = ID; s->tel.insert(tel); s->name = name; s->sex = sex; s->age = age; s->phe = phe; s->place = place; p = userListHead; s->nextuser = p->nextuser; p->nextuser = s; } void SInfo::userRead() //从文件读入数据 { user *p; p = userListHead; ifstream in("StudentList.txt"); if (!in) { cout name>>sex>>age>>ID>>tel>>phe>>place; userinsert(ID,tel,name,sex,age,phe,place); } } void SInfo::userSave() //保存用户信息 { user *p; p = userListHead->nextuser; ofstream out("StudentList.txt"); if (!out) { cout |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |