TmultiScore::TmultiScore(QMainWindow* mw, QWidget* parent) : TsimpleScore(1, parent), m_mainWindow(mw), m_inMode(e_multi), m_scale(1.0), m_clickedOff(0), m_currentIndex(-1), m_useAinim(true), m_addNoteAnim(true), m_selectReadOnly(false), m_isDisabled(false) { setObjectName(QStringLiteral("m_mainScore")); setStyleSheet(QStringLiteral("TsimpleScore#m_mainScore { background: transparent }")); setContentsMargins(2, 2, 2, 2); if (!TscoreNote::touchEnabled()) setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // it is off by default staff()->setZValue(11); // to be above next staves - TnoteControl requires it setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setMaximumWidth(QWIDGETSIZE_MAX); // revert what TsimpleScore 'broke' setAlignment(Qt::AlignCenter); if (qApp->applicationName() == QLatin1String("Scorek")) { addStaff(staff()); // TODO: main score does that - but TmultiScore is dependent on it then - try to move it here setNote(0, Tnote()); // To display fake empty note properly } }
int main(){ char *name; short age; float wages; int sid; while(1){ int Order = -1; printf("**员工档案管理系统**\n"); printf(" 1, 新增员工信息\n"); printf(" 2, 删除员工信息\n"); printf(" 3,更改员工信息\n"); printf(" 4,查询员工信息\n"); printf(" 5,保存\n"); printf(" 6,退出\n"); scanf("%d",&Order); switch(Order){ case 1: printf("请输入员工姓名:"); scanf("%s",name); printf("请输入员工年龄:"); scanf("%hu",&age); printf("请输入员工工资:"); scanf("%f",&wages); addStaff(name,age,wages); break; case 2: printf("请输入要删除的员工:"); scanf("%d",&sid); rmStaff(sid); catStaff(); break; case 4: catStaff(); break; case 6: return 0; break; default: printf("请输入正确的指令!\n"); } printf("\n\n"); } }
//Let the user input all required info of the new Staff //re-enter if the info is invalid //After all the info has been filled, display options: //1. Add Staff //call addStaff() //2. Re enter info //mainAddStaff() //0. return; void StaffList::createStaff() { string new_name, new_dob, new_address, new_dept, new_pos; int new_sal_rate; cout << "Name: "; cin.ignore(); getline(cin, new_name); cout << "DOB: "; //cin.ignore(); getline(cin, new_dob); cout << "Address: "; //cin.ignore(); getline(cin, new_address); cout << "Department: "; cin.ignore(); getline(cin, new_dept); cout << "Position: "; //cin.ignore(); getline(cin, new_pos); cout << "Salary rate: "; while (!(cin >> new_sal_rate)||new_sal_rate<0) { cout << "Invalid number!" << endl; cin.clear(); cin.ignore(256,'\n'); } int new_id = newID(); Staff newbie( new_id, new_name, new_dob, new_address, new_dept, new_pos, new_sal_rate); cout << "Choose one: " << endl; cout << "1. Add a staff member" << endl; cout << "0. Back" << endl; cout << "Enter Your option: "; int command; while (true) { cin >> command; if (cin && (command < 4) && (command > -1)) break; cout << "Invalid command!" << endl; cin.clear(); cin.ignore(256,'\n'); } switch (command) { case 1: if (userConfirm()) { addStaff(newbie); cout << "Add success! New staff member info: " << endl; newbie.Print(); cout << endl; } else { cout << "No change is commited"; } break; case 0: return; default: cout << "Invalid command!" << endl; break; } }