📄 info.h
字号:
#include "iostream"
#include "string"
using namespace std;
union info {
char level;
};
struct main_info {
string name;
string identityId;
char sex;
union info m_info;
struct main_info *next;
}*head;
main_info *create() {
main_info *p1 = NULL, *p2 = NULL;
head = NULL;
p1 = new main_info;
cout << "========== Input Information ==========" << endl;
cout << "---------------------------------------" << endl;
cout << "----------------Warning----------------" << endl;
cout << "1. \"Sex\" input 'M'(Male) or 'F'(Female)." << endl;
cout << "2. \"Level\" input 'T'(Teacher) or 'S'(Student)." << endl;
cout << "3. If you want to end edit. Please input \"END\" after the key word \"Name: \"." << endl;
cout << "---------------------------------------" << endl << endl;
cout << endl << "Please input the information: " << endl;
cout << "Name: ";
cin >> p1->name;
while (p1->name != "END") {
cout << "IdentityID: ";
cin >> p1->identityId;
cout << "Sex: ";
cin >> p1->sex;
cout << "Level: ";
cin >> p1->m_info.level;
if (head == NULL) head = p1;
else p2->next = p1;
p2 = p1;
p1 = new main_info;
cout << endl << "Please input the information: " << endl;
cout << "Name: ";
cin >> p1->name;
}
if (head != NULL) {
p2->next = NULL;
}
return head;
}
void print(main_info* head) {
cout << endl << "========== Information Display ==========" << endl;
while (head != NULL) {
cout << "Name: " << head->name << endl << "Identity ID: " << head->identityId << endl << "Sex: " << head->sex << endl << "Level: " << head->m_info.level << endl;
cout << "--------------------" << endl;
head = head->next;
}
cout << endl << "=========================================" << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -