int mainMenu(){ char* command = (char*) malloc (2*sizeof(char)); printf ("%s",menu); scanf("%s",command); if (strcmp(command,"x") == 0) { free (command); return 0; } if (strcmp(command,"1") == 0) { addMenu(); } if (strcmp(command,"2") == 0){ updateProductPriceMenu(); } if (strcmp(command,"3") == 0) { updateProductQuantityMenu(); } if (strcmp(command,"4") == 0) { removeProductMenu(); } if (strcmp(command,"5") == 0) { filterMenu(); } if (strcmp(command,"6") == 0) { sortMenu(); } if (strcmp(command,"7") == 0) { viewAll(); } free (command); return 1; }
int main() { Student table[SIZE]; int ch; int flag = 1; initializeTable(table); do { printf("\n 1. Add Record "); printf("\n 2. Modify Record "); printf("\n 3. Delete Record "); printf("\n 4. Search Record "); printf("\n 5. View All Record "); printf("\n 6. Exit "); printf("\n Enter Choice "); scanf("%d", &ch); switch(ch) { case 1: //add record addRecord(table); break; case 2: //modify record modify(table); break; case 3: //delete record deleteRecord(table); break; case 4: //search record search(table); break; case 5: //view all records viewAll(table); break; case 6: //exit flag = 0; break; default: printf("\n Wrong choice "); break; }//switch }while(flag == 1); return 0; }
//应用程式的主菜单:显示 int menuShow() { //变量定义表 uint MenuItem=1; scrcls(); puts("<=-------------------------------------=>"); puts(" 小 学 数 学 考 试 系 统"); puts(" Designed by www.fcsys.us."); puts("<=-------------------------------------=>"); puts(" [1]随机生成10数学试题"); puts(" [2]开始进行本次数学考试"); puts(" [3]保存本次数学考试记录"); puts(" [4]查询历史数学考试记录"); puts(" [5]当次前次考试成绩对比"); puts(" [6]保存考试成绩到文件中"); puts(" [7]退出小学数学考试系统"); puts("<=-------------------------------------=>"); printf("\n请输入当前的选择项目[1-7限定]:"); //处理用户输入选项 scanf("%d",&MenuItem); if(MenuItem>7||MenuItem<1) menuShow(); //0:控制重新显示菜单 else switch(MenuItem) //N:控制菜单执行 { case 1:genItem();break; case 2:doWork();break; case 3:saveCurrent(0);break; case 4:viewHistory(0);break; case 5:viewAll();break; case 6:saveAll();break; case 7:exit(0); } return 0; }
ExperienceWindow::ExperienceWindow(const DataLocationMgr* dataLocMgr, Player* player, GroupMgr* groupMgr, ZoneMgr* zoneMgr, QWidget* parent, const char* name) : SEQWindow("Experience", "ShowEQ - Experience", parent, name), m_dataLocMgr(dataLocMgr), m_player(player), m_group(groupMgr), m_zoneMgr(zoneMgr) { /* Hopefully this is only called once to set up the window, so this is a good place to initialize some things which otherwise won't be. */ m_ratio = 1; m_timeframe = 0; m_calcZEM=0; m_ZEMviewtype = 0; m_view_menu = new QPopupMenu( this ); m_view_menu->insertItem( "&All Mobs", this, SLOT(viewAll()) ); m_view_menu->insertItem( "Previous &15 Minutes", this, SLOT(view15Minutes()) ); m_view_menu->insertItem( "Previous &30 Minutes", this, SLOT(view30Minutes()) ); m_view_menu->insertItem( "Previous &60 Minutes", this, SLOT(view60Minutes()) ); m_view_menu->setItemChecked( m_view_menu->idAt(0), true ); m_view_menu->insertSeparator(); m_exp_rate_menu = new QPopupMenu( this ); m_exp_rate_menu->insertItem( "per &minute", this, SLOT(viewRatePerMinute()) ); m_exp_rate_menu->insertItem( "per &hour", this, SLOT(viewRatePerHour()) ); m_exp_rate_menu->setItemChecked( m_exp_rate_menu->idAt(0), true ); m_view_menu->insertItem( "Experience &Rate", m_exp_rate_menu ); m_view_menu->insertSeparator(); m_view_menu->insertItem( "Clear Kills", this, SLOT(viewClear()) ); m_view_menu->insertSeparator(); m_ZEM_menu = new QPopupMenu( this ); m_ZEM_menu->insertItem( "Calculated Value", this, SLOT(viewZEMcalculated()) ); m_ZEM_menu->insertItem( "Raw Value", this, SLOT(viewZEMraw()) ); m_ZEM_menu->insertItem( "Percent Bonus", this, SLOT(viewZEMpercent()) ); m_ZEM_menu->setItemChecked( m_ZEM_menu->idAt(0), true ); m_view_menu->insertItem( "ZEM View Options", m_ZEM_menu ); m_view_menu->insertItem( "Calculate ZEM on next kill", this, SLOT(calcZEMNextKill()) ); m_layout = new QVBoxLayout(boxLayout()); m_menu_bar = new QMenuBar( this ); m_menu_bar->insertItem( "&View", m_view_menu ); //m_layout->addSpacing( m_menu_bar->height() + 5 ); m_layout->addWidget(m_menu_bar); QGroupBox *listGBox = new QVGroupBox( "Experience Log", this ); m_layout->addWidget( listGBox ); m_exp_listview = new SEQListView(preferenceName(), listGBox); m_exp_listview->addColumn("Time"); m_exp_listview->addColumn("Mob"); m_exp_listview->addColumn("Level"); m_exp_listview->addColumn("Base Exp"); m_exp_listview->addColumn("ZEM total"); m_exp_listview->addColumn("Class total"); m_exp_listview->addColumn("Group total"); m_exp_listview->addColumn("Experience Gained"); m_exp_listview->restoreColumns(); m_exp_listview->setMinimumSize( m_exp_listview->sizeHint().width(), 200 ); QGroupBox *statsGBox = new QVGroupBox( "Statistics", this ); m_layout->addWidget( statsGBox ); QGrid *statsGrid = new QGrid( 4, statsGBox ); new QLabel( "Total Experience Received:", statsGrid ); m_total_received = new QLabel( statsGrid ); new QLabel( "Play Time:", statsGrid ); m_play_time = new QLabel( statsGrid ); new QLabel( "Total Mobs Killed:", statsGrid ); m_mob_count = new QLabel( statsGrid ); m_experience_rate_label = new QLabel( "Experience Rate (per minute):", statsGrid ); m_experience_rate = new QLabel( statsGrid ); new QLabel( "Average Experience per Mob:", statsGrid ); m_average_per_mob = new QLabel( statsGrid ); new QLabel( "Estimated Kills To Level:", statsGrid ); m_kills_to_level = new QLabel( statsGrid ); new QLabel( "Experience Remaining:", statsGrid ); m_experience_remaining = new QLabel( statsGrid ); new QLabel( "Estimated Time To Level:", statsGrid ); m_time_to_level = new QLabel( statsGrid ); // ewww, why can't we just get it from QGrid? :( ((QGridLayout *)statsGrid->layout())->setColStretch( 1, 1 ); ((QGridLayout *)statsGrid->layout())->setColStretch( 3, 1 ); statsGrid->layout()->setSpacing( 5 ); updateAverage( ); // timer to update the average xp QTimer *timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), SLOT(updateAverage())); timer->start(15*1000); // calculate every 15 seconds QFileInfo fileInfo = m_dataLocMgr->findWriteFile("logs", "exp.log"); m_log = fopen(fileInfo.absFilePath(), "a"); if (m_log == 0) { m_log_exp = 0; seqWarn("Error opening exp.log, no exp will be logged this session"); } fileInfo = m_dataLocMgr->findWriteFile("logs", "newexp.log"); m_newExpLogFile = fileInfo.absFilePath(); }
Home::Home(QWidget *parent) : QBookForm(parent), m_category1(0) , m_category2(0) , m_category3(0) , memoryCategory1List(0) , memoryCategory2List(0) , memoryCategory3List(0) , b_isMostRecentFromSD(false) { setupUi(this); connect(libraryBtn, SIGNAL(clicked()), this, SLOT(goToLibrary())); connect(helpBtn, SIGNAL(clicked()), this, SLOT(goToHelp())); connect(searchBtn, SIGNAL(clicked()), this, SLOT(goToSearch())); connect(settingsBtn, SIGNAL(clicked()), this, SLOT(goToSettings())); connect(showAllBtn, SIGNAL(clicked()), this, SLOT(viewAll())); connect(recommendedBtn, SIGNAL(clicked()), this, SLOT(showOptions())); #ifndef HACKERS_EDITION connect(storeBtn, SIGNAL(clicked()), QBookApp::instance(),SLOT(goToShop())); #endif connect(readBookBtn, SIGNAL(clicked()), this, SLOT(openMostRecentBook())); QFile fileSpecific(":/res/home_styles.qss"); QFile fileCommons(":/res/home_styles_generic.qss"); fileSpecific.open(QFile::ReadOnly); fileCommons.open(QFile::ReadOnly); QString styles = QLatin1String(fileSpecific.readAll() + fileCommons.readAll()); setStyleSheet(styles); if(QBook::getInstance()->getResolution() == QBook::RES600x800){ defaultHelpBook = new BookInfo(QString(USERGUIDEPATH) + "/userGuideTouch_" + QBook::settings().value("setting/language", QVariant("es")).toString()+ ".epub"); }else{ //We do it to preserve back compatibility defaultHelpBook = new BookInfo(QString(USERGUIDEPATH) + "/userGuide_" + QBook::settings().value("setting/language", QVariant("es")).toString()+ ".pdf"); } defaultHelpBook->title = tr("Guia de Ayuda"); defaultHelpBook->thumbnail = ":/res/unknow_book.png"; defaultHelpBook->fontSize = 1; //Optimal to show images homeBooksListOptions = new HomeBooksListOptions(this); connect(homeBooksListOptions, SIGNAL(viewSelected(Home::VIEW)), this, SLOT(viewSelected(Home::VIEW))); connect(homeBooksListOptions, SIGNAL(hideMe()), this, SLOT(showOptions())); connect(homeBooksList, SIGNAL(openBook(const BookInfo*)), this, SLOT(openBook(const BookInfo*))); #ifndef HACKERS_EDITION memoryCategory1List = new bqDeviceServicesCategoryObject(); memoryCategory2List = new bqDeviceServicesCategoryObject(); memoryCategory3List = new bqDeviceServicesCategoryObject(); m_category1 = new bqDeviceServicesCategoryObject(); m_category2 = new bqDeviceServicesCategoryObject(); m_category3 = new bqDeviceServicesCategoryObject(); #endif bookAccessLbl->hide(); numberAccessLbl->hide(); subscriptionTagLbl->hide(); currentView = Home::RECENT; }