void mainMenu() { int sel = -1; while(sel != 0) { printf("MENU:\n"); printf("1. Add a user\n"); printf("2. Del a user\n"); printf("3. Edit a user\n"); printf("4. Verify a user\n"); printf("Selection: "); scanf("%d", &sel); switch(sel) { case 1: addMenu(); break; case 2: delMenu(); break; case 3: editMenu(); break; case 4: verifyMenu(); break; default: sel = 0; } } }
void editCompositeBObject(const string& name, ProtoCompositeBObject* object) { Info("Editing composite object " << name); DynamicMenu editMenu("Select an attribute to edit"); editMenu.addChoice("Keywords", [&]() { editObjectKeywords(object); }); editMenu.addChoice("Layers", [&]() { editCompositeLayers(object); }); }
void administrator() { int choice = 0; int password; //check to see if password entered correctly, 0 for incorrect, 1 for correct //Password: Password1! //key: 1234 puts("Please enter the administrator password. 3 attempts remaining:"); password = checkPassword(); if (password == 0) { puts("Password and Key combination incorrectly entered 3 times.\nProgram is exiting..."); return; } while (1) { if (choice >= 0 && choice <= 11) { CLRSCR(); //clears window up until this point puts("-------------------------------------------------------"); puts("1. Make/Edit/Delete a booking"); puts("2. Complete a booking"); puts("3. Search for available tables by no. of seats"); puts("4. Display menu and take order"); puts("5. Display receipt"); puts("6. Show information on tables"); puts("7. Show future bookings"); puts("8. Edit Tables"); puts("9. Edit Menu"); puts("10. Change Administrator password"); puts("0. Exit"); printf("-------------------------------------------------------"); } choice = onlyInt(2); switch (choice){ case 0: return; case 1: editBooking(); break; //make a booking case 2: completeBooking(); break; //complete booking case 3: showAvailableTables(); break; case 4: selectTable(1); break; //display menu function case 5: selectTable(2); break; //display receipt function case 6: showAllTables(); break; case 7: showFutureBookings(); break; case 8: editTables(); break; case 9: editMenu(); break; //edit menu.dat file case 10: changePassword(); return; //program logs user out after changing password default: printf("That is not one of the options!\nPlease enter again: "); } } }
void iDraw() { int m,n; iClear(); iSetcolor(1,1,1); iFilledRectangle(1,1,width-19,height-18); //draw text box iSetcolor(0,0,0); iRectangle(1,1,width-19,height-19); //draw text boundary if (selflag) { for (int l=selSI; l<=selEI; l++) { int sx = (l==selSI)?( (selSJ==0)?3:selSJ*charSpace) : 3; int sy = height - 17 - (l+1-s)*lineSpace - 5; int w; if (l==selSI) w = (selSI == selEI) ? selEJ-selSJ : strlen(str+l*charMax*sizeof(char))-selSJ; else if (l==selEI) w = selEJ; else w = (strlen(str+l*charMax*sizeof(char))==0)?1:strlen(str+l*charMax*sizeof(char)); iSetcolor(.8,.8,.9); iFilledRectangle(sx,sy,w*charSpace,lineSpace); } } iSetcolor(0,0,0); for (m=height-17-lineSpace, n=s; n<=imax; m-=lineSpace, n++) { iText(3, m, str+n*charMax*sizeof(char),font); //print text } if (fOpen) { fileopen(); iSetcolor(0,0,0); iText((width-15)/2-135,(height-19)/2+62,subTemp+r); //print file open text } else if (fsave) { filesave(); iSetcolor(0,0,0); iText((width-15)/2-135,(height-19)/2+62,subTemp+r); //print file save as text } else if (aboutR) { aboutRword(); } cursor(); //draw cursor iSetcolor(.9,.9,.9); iFilledRectangle(3,height-17,width-19,17); iSetcolor(0,0,0); iLine(2,height-18,width-19,height-18); iSetcolor(0,0,0); iText(5,height-12,"File",GLUT_BITMAP_HELVETICA_12); iSetcolor(0,0,0); iText(45,height-12,"Edit",GLUT_BITMAP_HELVETICA_12); iSetcolor(0,0,0); iText(85,height-12,"Format",GLUT_BITMAP_HELVETICA_12); iSetcolor(0,0,0); iText(141,height-12,"Help",GLUT_BITMAP_HELVETICA_12); //draw menus if (menuflag == 1) { fileMenu(); //draw file drop down menu } else if (menuflag == 2) { editMenu(); //draw edit drop down menu } else if (menuflag == 3) { formatMenu(); //draw format drop down menu } else if (menuflag == 4) { helpMenu(); //draw help drop down menu } if (fontflag) { fontlist(); //draw font list } else if (saveM) { saveMessage(); //message box while exitting } scrollbar(); // draw scrollbar if (load) loading(); //load window }
// allows you to search for a contact by first/surname and select mutliple fields to edit for that chosen contact void edit(){ struct contact *curr; char toEdit[15], confirm[4], updated[25]; BOOL found = false, edited = false; int choice; printf("Enter contact to edit? (case sensitive) : "); scanf("%s", &toEdit); while (getchar() != '\n'); // temporary node curr = listHead->next; while(curr->next != NULL && edited == false){ if(strstr(curr->fName, toEdit) || strstr(curr->sName, toEdit)){ found = true; printf("\n%s %s\n%s\n%s\n%s\n\n", curr->fName, curr->sName, curr->phone, curr->email, curr->company); printf("Is this the contact? (y/es n/o) : "); scanf("%s", &confirm); while (getchar() != '\n'); if(tolower(confirm[0]) == 121){ do{ choice = editMenu(); switch(choice){ case 0: // exit break; case 1: // First printf("New First Name: "); scanf("%s", &updated); strcpy(curr->fName, updated); edited = true; break; case 2: // Surname printf("Surname:\n"); scanf("%s", &updated); strcpy(curr->sName, updated); edited = true; break; case 3: // Phone printf("Phone Number:\n"); scanf("%s", &updated); strcpy(curr->phone, updated); edited = true; break; case 4: // Email printf("Email:\n"); scanf("%s", &updated); strcpy(curr->email, updated); edited = true; break; case 5: // Company printf("Company:\n"); scanf("%s", &updated); strcpy(curr->company, updated); edited = true; break; default: printf("Not a valid number, re-enter.\n"); break; } // switch }while(choice != 0); if(edited == true){ printf("Update Successful!\n"); printf("\n%s %s\n%s\n%s\n%s\n\n", curr->fName, curr->sName, curr->phone, curr->email, curr->company); edited = true; } // if } else{ curr = curr->next; } } // if else{ curr = curr->next; } } // while if(found == false){ printf("Could not find: %s\n", toEdit); } else if(found == true && edited == false){ printf("No more entries for: %s\n", toEdit); } }