void BootMenu::Init() { AbstractState::Init(); ClearScreen(); printMenu(); }
int main() { struct stack p; int data,ch, data1, m; printf("Enter the maximum size of the stack\n"); scanf("%d",&m); initstack(&p,m); do { printMenu(); printf("Enter your choice\n"); scanf("%d",&ch); switch(ch) { case 1: printf("Enter the element to be pushed\n"); scanf("%d",&data); push(&p, data); break; case 2: data1 = pop(&p); if(data1 != -1000) printf("The popped element is %d\n",data1); break; case 3: printf("The contents of the stack are"); display(p); printf("\n"); break; default: return 0; } } while(1); return 0; }
/************************************************************************* Function: main() **************************************************************************/ int main(void){ init_wyvern(); LED_green_on(); LED_ucgreen_on(); char input; menuScreen = 'a'; for( ; ; ){ printMenu(); input = '0'; outgoing.command = input; if(DataInReceiveBuffer()){ input = ReceiveByte(); } getJoystick(); controllerCommand(input); controllerTransmit(); _delay_ms(5); if(incoming.battery < 100){ LED_red_toggle(); LED_ucred_toggle(); LED_blue_toggle(); LED_yellow_toggle(); LED_green_toggle(); } } return 0; }
int main(){ while( 0 == 0 ) { printMenu(); printf("Enter command: "); scanf("%s", choice); if (choice[0]=='i'){ interactive(); } else if (choice[0]=='a'){ automatic(); } else if (choice[0]=='e'){ printf("exiting\n\n"); break; } else printf("Please enter a valid option\n"); if (status == 1){ //only print the final addresses if everything has gone accordingly printAddress(); status=0; //reset status } } return EXIT_SUCCESS; }
void Debugger::halt() { pthread_mutex_lock(&printingMutex); state = dsHaltPending; printMenu(); pthread_mutex_unlock(&printingMutex); }
int main(int argc, char **argv){ if (argc < 2) { printf("No filename given.\n"); exit(1); } char* filename = argv[1]; int choice; int menuSize = 4; struct fun_desc menu[] = { {"Mem Display", &memDisplay}, {"File Display", &fileDisplay}, {"File Modify", &fileModify}, {"File Copy", &fileCopy} }; printf("File: %s\n", filename); while (1) { printMenu(menu, menuSize); printf("Choice: "); choice = getInt(); if (choice > 3 || choice < 0) { break; } (menu[choice].fun)(filename); } printf("Bye!\n"); return 0; }
int main() { char ch; printMenu(); while(std::cin >> ch) { switch(ch) { case 'a' : std::cout << "Nice choice\n"; break; case 'b' : std::cout << "Try another letter\n"; break; case 'c' : std::cout << "It's great, but not\n"; break; case 'd' : std::cout << "ZzZzZz..\n"; break; default: std::cout << "Please enter a, b, c or d: "; } } std::cin.get(); return 0; }
void Menu::parseInput() { if (!hasInput()) { return; } String data = Serial.readString(); if (currentMenuChoice != MENU_NONE) { handleSubInput(data); return; } switch (data.toInt()) { case 0: printMenu(); break; case MENU_SET_NBR_PHOTOS: Serial.println("Enter number of photos"); currentMenuChoice = MENU_SET_NBR_PHOTOS; break; case MENU_SET_EXPOSURE_TIME: Serial.println("Enter wait time per photo [ms]"); currentMenuChoice = MENU_SET_EXPOSURE_TIME; break; case MENU_SET_MOTOR_RUN_TIME: Serial.println("Enter trolley move time [ms]"); currentMenuChoice = MENU_SET_MOTOR_RUN_TIME; break; case MENU_SET_DIRECTION: Serial.println("Enter trolley direction [L/R]"); currentMenuChoice = MENU_SET_DIRECTION; break; case 5: resetTrolley(); break; case 6: start(); break; case 7: stop(); break; case 9: printStatus(); break; default: printMenu(); break; } }
void PortaEmbarque::listCategoriasAvioesInfo() { vector < vector <string> > info; info.push_back(_categorias_avioes_info); string title = (string)"Possiveis categorias de aviƵes"; vector <string> colnames; colnames.push_back(""); printMenu(title, info, colnames, false, false, false, true); cout << endl; }
static int menuGetChoice ( MENU_ITEM menuTable[], int numMenuItems, char *title, unsigned long options ) { /*char inputLine[MAX_INPUT_LINE_SIZE];*/ int choice; /* * Suppress display of the menu the first time if we're asked */ if (!(options & MENU_OPT_SUPPRESS_DISP)) printMenu (menuTable, numMenuItems, title); /* * Prompt for a selection. Redisplay the menu and prompt again * if there's an error in the selection. */ choice = -1; while (choice < 0 || choice > numMenuItems) { diag_printf ("\nEnter the menu item number (0 to quit): "); choice = decIn (); if (choice < 0 || choice > numMenuItems) printMenu (menuTable, numMenuItems, title); } if (choice == 0) return (QUIT); return (choice - 1); } /* end menuGetChoice () */
void Debugger::stepOut() { if (state != dsRunningOut && state != dsRunningOver && flowLayers.size() > 1) { pthread_mutex_lock(&printingMutex); state = dsStepOutPending; printMenu(); pthread_mutex_unlock(&printingMutex); } }
void Debugger::stop() { if (state == dsRunning) { pthread_mutex_lock(&printingMutex); state = dsStopped; printMenu(); pthread_mutex_unlock(&printingMutex); } }
void InboundRadioNodeMenu::Init() { AbstractState::Init(); if (!initialized) { numberOfNodes = Settings::GetInboundRadioNodes(nodes); initialized = true; } printArrow(); printMenu(); }
int main(int argc, char** argv) { atexit(sudokuExit); printWelcomeScreen(); CLEAR; printMenu(); // printSudoku(grid); // return (EXIT_SUCCESS); }
void Debugger::stepInto() { if (state != dsRunningOut && state != dsRunningOver) { pthread_mutex_lock(&printingMutex); state = dsStepIntoPending; printMenu(); pthread_mutex_unlock(&printingMutex); } }
void menu_loop(void const *args) { int count = 0; while(true) { setMenu(); if (++count % 10 == 0) printMenu(menuItem); Thread::wait(100); } }
int menu(){ int choiche=0; printMenu(); do{ if(choiche<0 || choiche>10) printf("\ninserito numero non ammesso\nPrego reinserire\n"); scanf("%d", &choiche); getchar(); }while(choiche<0 || choiche>10); return choiche; }
int main() { char opt; int i,j; printMenu(); scanf(" %c", &opt); while(opt != 'q') { switch (opt) { case 's' : printSquare(); break; case 't' : printTriangle(); break; default: printf("Unknown option\n"); } printMenu(); scanf(" %c", &opt); } return 0; }
int main(int argc, char *argv[]) { char input[5] = " "; char *address = argv[1]; while(strcmp(input,"quit")!=0) { printMenu(input,address,input); } return 0; }
int main() { Library lib; int select = 0; lib.fBooks = "books.txt"; lib.fCustomers = "customers.txt"; // Load Books if(!loadBooks(lib.fBooks, lib.books, lib.maxBooks, lib.numBooks)) { cout << "Failed to Load Books" << endl; return 0; } // Load Customers if(!loadCustomers(lib.fCustomers, lib.customers, lib.maxCust, lib.numCusts)) { cout << "Failed to Load Customers" << endl; return 0; } // Menu while(select != 6) { printMenu(); cin >> select; cout << endl; if(select == 1) { // List Books printBooks(lib.books, lib.numBooks); } else if(select == 2) { // Add Book To Deposit cout << "Book Title: "; cin.ignore(); getline(cin, lib.books[lib.numBooks].title); cout << "Year Published: "; cin >> lib.books[lib.numBooks].yearPublished; cout << "Number of Pages: "; cin >> lib.books[lib.numBooks].pages; lib.books[lib.numBooks].checkedOut = false; lib.numBooks++; cout << "Book added." << endl << endl; } else if(select == 4)
/* * This method gets the menu choice from the user. */ char getMenuChoice(void){ unsigned char c; printMenu(); c = getc(stdin); #ifdef DEBUG printf("Your choice: %d\n", c); #endif if(c != '0'){ getc(stdin); // This gets the "enter" key ('\r') and eats it so the loop isn't continued. } return c; }
int start() { int opcion = 0; ArrayList *calendario = al_newArrayList(); cargarEventosDeArchivo(calendario); do { system("cls"); printMenu(); pedirInt(&opcion,"Ingrese una opcion:\n",7,1,"Ingrese una opcion valida. Entre 1 y 6\n"); switch(opcion) { case NUEVO: if(crearNuevoEvento(calendario)) printf("Hubo un error al intentar crear el evento\n"); pausa("Presione una tecla para volver\n"); break; case CONSULTAR_DIA: if(consultarFecha(calendario)) printf("Hubo un error con la consulta\n"); pausa("Presione una tecla para volver\n"); break; case MODIFICAR: if(modificarEvento(calendario)) printf("No se pudo completar la modificacion\n"); break; case ELIMINAR: if(eliminarEvento(calendario)) printf("No fue posible eliminar el evento\n"); pausa("Presione una tecla para volver\n"); break; case EXPORTAR: if(exportarCalendario(calendario)) printf("Hubo un error al intentar exportar el calendario\n"); pausa("Presione una tecla para volver\n"); break; case LIMPIAR: if(limpiarCalendario(calendario)) printf("No se pudo completar la operacion\n"); pausa("Presione una tecla para volver\n"); break; } }while( opcion != SALIR); guardarEventosEnArchivo(calendario); limpiarMemoria(calendario); calendario->deleteArrayList(calendario); return 0; }
tInt8 MenuInteract(tOutput* output,tMenu* Menu,tInt16 offsy,tInt16 offsx) { tInt16 ch; int i; tInt8 retval; ch=0; printMenu(output,Menu,offsy,offsx); while (ch!=KEYENTER) { ch=getkey((tKeyTab*)output->pKeyTab,0); switch(ch) { case KEYLEFT: MenuMoveLeft(Menu); break; case KEYRIGHT: MenuMoveRight(Menu); break; case KEYUP: MenuMoveUp(Menu); break; case KEYDOWN: MenuMoveDown(Menu); break; case KEYTAB: Menu->menuitemactive=(Menu->menuitemactive+1)%Menu->menuitemnum;break; case KEYENTER: retval=Menu->menuitemactive; break; default: if (ch>=' ' && ch<127) { if (ch>='a' && ch<='z') ch-=32; for (i=0;i<Menu->menuitemnum;i++) { if (Menu->MenuItems[i].hotkey==ch) { Menu->menuitemactive=i; ch=KEYENTER; } } } break; } printMenu(output,Menu,offsy,offsx); } return Menu->menuitemactive; }
int LCDUI::stringMenu( char *menuItems[], size_t menuLen ) { int top = 0; int pos = 0; printMenu( menuItems, menuLen, top, pos ); for (;;) { int reading = _encoder->readNav(); if ( reading ) { pos = max( 0, pos + reading ); pos = min( pos, menuLen-1 ); if ( reading > 0 ) { top = max( 0, pos - ROWS + 1 ); } else { top = min( pos, top ); } printMenu( menuItems, menuLen, top, pos ); } if ( _encoder->click() ) { return pos; } } }
int main() { char * menu[] = { "1. Voce 1\n", "2. Voce 2\n", "3. Voce 3\n", NULL }; printMenu(menu); getchar(); return 0; }
void shellcodeCreator() { lastMenu = mainMenu; currentMenu = shellcodeCreator; freeMenu(); addItemMenu("Linux x86", shellcodeCreator_linux86); addItemMenu("Linux x86_x64", shellcodeCreator_linux64); addItemMenu("Windows x86", shellcodeCreator_windows86); addItemMenu("Windows x64", shellcodeCreator_windows64); addItemMenu("Help", printHelp); addItemMenu("Back", lastMenu); printMenu(); }
/* ** Function: onHook (state) ** ** Description: ** called when current state is onHook and interrupt occurs ** ** Input Parameters: ** pState: pointer to channel state data structure ** eInput: interrupt that has occured ** ** Return: ** */ static void OnHook (chanState *pState, ProslicInt eInput) { int tone = USA_DIAL_TONE; if (eInput==LOOP_STATUS) { ProSLIC_ToneGenSetup(pState->ProObj,tone); ProSLIC_ToneGenStart(pState->ProObj,FALSE); printMenu(); pState->digitCount=0; pState->currentState = DialTone; } else if (eInput>=PQ1 && eInput<=PQ6) { powerAlarm(pState); } }
//Begin Main int main() { srand(time(0)); int numWordsInDictionary, i, flag; //flag, when dictionary > 10,000 int choice, score, isPlaying; char word[8], letters[8], bestWord[8]; char ** dictionary = getDictionaryWords(dictionary, &numWordsInDictionary, &flag); //initializing values strcpy(bestWord, ""); //clearing garbage score = 0; isPlaying = 1; if(flag != 0) { printf("Welcome to the Scrabble Practice Program!\n\n"); generateHand(letters); printf("Here are your letters: %s", letters); while(isPlaying == 1) { choice = printMenu(choice); if(choice == 1) { getWord(word); if( checkValid(word, dictionary, numWordsInDictionary) == 1 ) checkScore(word, bestWord, &score); else printf("That word is not found within our current dictionary!\n"); } else break; } printf("Your best word was %s worth %d points.\n", bestWord, score); for(i = 0; i < numWordsInDictionary; i++) free(dictionary[i]); free(dictionary); } else { printf("Error! The dictionary cannot be more than 10,000 words!\n"); free(dictionary); } return 0; }
void setMenu() { if (Down) { joystickPos = "DOWN"; if (menuItem >= 0 && menuItem < 9) printMenu(++menuItem); } else if (Left) joystickPos = "LEFT"; else if (Click) joystickPos = "CLICK"; else if (Up) { joystickPos = "UP"; if (menuItem <= 9 && menuItem > 0) printMenu(--menuItem); } else if (Right) joystickPos = "RIGHT"; else joystickPos = "CENTRE"; }
AbstractState* SettingsMenu::Up() { resetTime(); if (cursorIndex > 0) { cursorIndex--; if (cursorIndex < firstRowIndex) { firstRowIndex--; printMenu(); } printArrow(); } return NULL; }