• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ print_menu函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中print_menu函数的典型用法代码示例。如果您正苦于以下问题:C++ print_menu函数的具体用法?C++ print_menu怎么用?C++ print_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了print_menu函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(void)
{
	int menu_select;
	int value;

	HASH_NODE* hash_table[HASH_BUCKET];
	hash_init(hash_table);

	for(;;)
	{
		menu_select = print_menu();

		switch(menu_select)
		{
		case 1:
			printf("Insert value>"); scanf("%d",&value);
			hash_insert(hash_table,value);
			break;
		case 2:
			printf("Can't select this menu\n");
			break;
		case 3:
			printf("Insert value>"); scanf("%d",&value);
			HASH_NODE* node = hash_search(hash_table,value);
			printf("Result:");
			if(node==NULL)
			{
				printf("Not Found:%d\n",value);
			}
			else
			{
				printf("Found:%d at %p\n",value,node);
			}
			break;
		case 4:
			printf("HASH>\n");
			hash_print(hash_table);
			break;
		case 5:
			return 0;
			break;
		default:
			printf("Please select 1 to 5\n");
			break;
		}
	}

	return 1;
}
开发者ID:ainehanta,项目名称:J3program,代码行数:49,代码来源:No1018_1.c


示例2: main

int main()
{
	int selected_option = NONE_OPTION;
	pre_init();

	do
	{
		print_menu();
		selected_option = get_opt();
		perform_effect(selected_option);
	}
	while(selected_option != EXIT_OPTION);

	return 0;
}
开发者ID:mangel,项目名称:ltp_port_programs,代码行数:15,代码来源:motor_control2.cpp


示例3: serial_init

void serial_init( )
{
	// Set the baud rate to 9600 bits per second.  Each byte takes ten bit
	// times, so you can get at most 960 bytes per second at this speed.
	serial_set_baud_rate(USB_COMM, 9600);

	// Start receiving bytes in the ring buffer.
	serial_receive_ring(USB_COMM, receive_buffer, sizeof(receive_buffer));
	
	memset( my_received_buffer, 0, sizeof(my_received_buffer));
	
	serial_print_string( "USB Serial Initialized" );
	serial_print_string( "" );
	print_menu();
}
开发者ID:janssens2,项目名称:MSSE_RC,代码行数:15,代码来源:serial_USB.c


示例4: menu

void	menu(void)
{
	srand(time(NULL));
	Window win;
	clear();
	start_color();
	init_pair(1,COLOR_BLUE,COLOR_BLACK);
	init_pair(2,COLOR_RED,COLOR_BLACK);
	attron(COLOR_PAIR(1));
	print_score(win);
	print_logo(win);
	print_menu(win);
	attroff(COLOR_PAIR(1));
	refresh();
}
开发者ID:avallete,项目名称:CPPool,代码行数:15,代码来源:ft_retro.cpp


示例5: menu_down

void menu_down(){

    ///\fn void menu_down()
    ///\brief Deplasarea in jos in menu.
    ///
    ///Implementarea deplasarii in jos in cadrul menu-ului pentru selectarea optiunii dorite.


    if(highlighted_item < menu[current_menu].nr_items-1)
        highlighted_item ++;
    else
        highlighted_item = 0;
    print_menu();
    Sleep(50);
}
开发者ID:dumitrubogdanmihai,项目名称:levenshtein-project,代码行数:15,代码来源:menu.c


示例6: endtest_bridge

/**
 ****************************************************************************************
 * @briefend of test option 
  * 
 ****************************************************************************************
*/
void endtest_bridge(short int *idx)
{
		short int index2 = 0;
		char bchoice;
		printf_string("\n\r\n\rPress m for Engineering Examples Menu or x to exit : ");
		while(1){	
				if (index2 == 1) break;
				bchoice = uart_receive_byte();
				switch (bchoice){
						case 'm' : print_menu(); index2 = 1; break;
						case 'x' : (*idx)=1; index2 = 1; break;
						default : ; break;
				};
		};
}
开发者ID:yangchengble,项目名称:blood_pressure,代码行数:21,代码来源:DA1450_examples.c


示例7: c_entry

/*********************************************************************//**
 * @brief		c_entry: Main program body
 * @param[in]	None
 * @return 		int
 **********************************************************************/
int c_entry (void)
{
	/* Initialize debug via UART0
	 * – 115200bps
	 * – 8 data bit
	 * – No parity
	 * – 1 stop bit
	 * – No flow control
	 */
	debug_frmwrk_init();

	// print welcome screen
	print_menu();

	/* In this example:
	 * Suppose that the RTC need periodically adjust after each 5 second.
	 * And the time counter need by incrementing the counter by 2 instead of 1
	 * We will observe timer counter after calibration via serial display
	 */
	// Init RTC module
	RTC_Init(LPC_RTC);

	/* Enable rtc (starts increase the tick counter and second counter register) */
	RTC_ResetClockTickCounter(LPC_RTC);
	RTC_Cmd(LPC_RTC, ENABLE);

	//Set current time = 0
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_SECOND, 0);

	/* Setting Timer calibration
	 * Calibration value =  5s;
	 * Direction = Forward calibration
	 * So after each 5s, calibration logic can periodically adjust the time counter by
	 * incrementing the counter by 2 instead of 1
	 */
	RTC_CalibConfig(LPC_RTC, 5, RTC_CALIB_DIR_FORWARD);
	RTC_CalibCounterCmd(LPC_RTC, ENABLE);

	/* Set the CIIR for second counter interrupt*/
	RTC_CntIncrIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE);

    /* Enable RTC interrupt */
    NVIC_EnableIRQ(RTC_IRQn);

    /* Loop forever */
    while(1);
    return 1;
}
开发者ID:readermank,项目名称:kico_si5,代码行数:53,代码来源:rtc_calib.c


示例8: c_entry

/*********************************************************************//**
 * @brief       c_entry: Main CAN program body
 * @param[in]   none
 * @return      none
 **********************************************************************/
void c_entry(void)
{
    /* Initialize debug via UART0
     * – 115200bps
     * – 8 data bit
     * – No parity
     * – 1 stop bit
     * – No flow control
     */
    debug_frmwrk_init();
    print_menu();

    /* Initialize CAN1 peripheral
     * Note: Self-test mode doesn't require pin selection
     */
    CAN_Init(_USING_CAN_NO, 125000);

    //Enable self-test mode
    CAN_ModeConfig(_USING_CAN_NO, CAN_SELFTEST_MODE, ENABLE);

    //Enable Interrupt
    CAN_IRQCmd(_USING_CAN_NO, CANINT_RIE, ENABLE);
    CAN_IRQCmd(_USING_CAN_NO, CANINT_TIE1, ENABLE);

    //Enable CAN Interrupt
    NVIC_EnableIRQ(CAN_IRQn);

    CAN_SetAFMode(CAN_ACC_BP);

    CAN_InitMessage();

    _DBG_("Transmitted buffer:");

    PrintMessage(&TXMsg);

    /** To test Bypass Mode: we send infinite messages to CAN2 and check
     * receive process via COM1
     */
    CAN_SendMsg(_USING_CAN_NO, &TXMsg);

#if (_USING_CAN_NO == CAN_1)
    LPC_CAN1->CMR |=(1<<4); //Self Reception Request
#else
    LPC_CAN2->CMR |=(1<<4);
#endif

    while (1);
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:53,代码来源:Can_Selftest.c


示例9: c_entry

/*********************************************************************//**
 * @brief		c_entry: Main program body
 * @param[in]	None
 * @return 		int
 **********************************************************************/
int c_entry (void)
{

	/* Initialize debug via UART0
	 * – 115200bps
	 * – 8 data bit
	 * – No parity
	 * – 1 stop bit
	 * – No flow control
	 */
	debug_frmwrk_init();

	// print welcome screen
	print_menu();

	/* Initialize and configure RTC */
	RTC_Init(LPC_RTC);

	RTC_ResetClockTickCounter(LPC_RTC);
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_SECOND, 0);

	/* Set alarm time = 5s.
	 * So, after each 5s, RTC will generate and wake-up system
	 * out of Deep PowerDown mode.
	 */
	RTC_SetAlarmTime (LPC_RTC, RTC_TIMETYPE_SECOND, 5);

	RTC_CntIncrIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, DISABLE);
	/* Set the AMR for 5s match alarm interrupt */
	RTC_AlarmIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE);
	RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM);

	_DBG_("Press '1' to enter system in Deep PowerDown mode");
	while(_DG !='1');

	RTC_Cmd(LPC_RTC, ENABLE);
	NVIC_EnableIRQ(RTC_IRQn);

	_DBG_("Enter Deep PowerDown mode...");
	_DBG_("Wait 5s, RTC will wake-up system...\n\r");

	// Enter target power down mode
	CLKPWR_DeepPowerDown();

	while(1);
	return 1;
}
开发者ID:m3y54m,项目名称:32bitmicro,代码行数:52,代码来源:rtc_deeppwd.c


示例10: main

int main() {
	unsigned int maxSize = 10;
	pqueue_t pq = pqueue_empty(maxSize);
	bool exit = false;
	char *option = NULL;
	unsigned int *u = calloc(1,sizeof(unsigned int));
	unsigned int v;
	do {
		option = print_menu();
		switch(*option) {
			case ADD:
				printf("\nPor favor ingrese el nodo: ");
				if(!pqueue_is_full(pq)) {
					scanf("%u",&v);
					*u = v;
					pqueue_enqueue(pq, *u);
					printf("\nExito.\n");
				} else {
					printf("La cola esta llena\n");
				}
				
				break;
			case SHOW:
				if(!pqueue_is_empty(pq)) {
					*u = pqueue_fst(pq);
					printf("\nEl maximo es: %u\n",*u);
				} else {
					printf("La cola está vacia\n");
				}
				break;
			case POP:
				if(!pqueue_is_empty(pq)) {
					pqueue_dequeue(pq);
					printf("\nSe elimino correctamente\n");
				}
				break;
			case EXIT:
				exit = true;
				break;
			
		}
		free(option);
        option = NULL;
	} while(!exit);
	pq = pqueue_destroy(pq);

}
开发者ID:tinrodriguez8,项目名称:sourceProjects,代码行数:47,代码来源:test+pq.c


示例11: c_entry

int c_entry(void)
{
	// Init LED port
	LED_Init();

	/*
	 * Initialize debug via UART
	 */
	debug_frmwrk_init();

	// print welcome screen
	print_menu();

	// Read back TimeOut flag to determine previous timeout reset
	if (WDT_ReadTimeOutFlag()){
		_DBG_(info1);
		// Clear WDT TimeOut
		WDT_ClrTimeOutFlag();
	} else{
		_DBG_(info2);
	}

	// Initialize WDT, IRC OSC, interrupt mode, timeout = 2000000 microsecond
	WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
	// Start watchdog with timeout given
	WDT_Start(WDT_TIMEOUT);

	// set timer 100 ms
	Timer_Wait(100);

	while (1){
		// Wait for 100 millisecond
		while ( !(TIM_GetIntStatus(LPC_TIM0,0)));
		TIM_ClearIntPending(LPC_TIM0,0);
		//turn on led
		FIO_ByteSetValue(2, 0, LED_PIN);

		// Wait for 100 millisecond
		while ( !(TIM_GetIntStatus(LPC_TIM0,0)));
		TIM_ClearIntPending(LPC_TIM0,0);
		//turn off led
		FIO_ByteClearValue(2, 0, LED_PIN);
	}

	return 0;
}
开发者ID:Lzyuan,项目名称:STE-LPC1768-,代码行数:46,代码来源:wdt_reset_test.c


示例12: Vga_init

void
Vga_init ( struct vga_t *x, int cpuid, bit32u_t pmem_base )
{
	ASSERT ( x != NULL );

	x->fd = Open2_fmt ( O_WRONLY | O_CREAT | O_TRUNC, 
			    S_IRUSR | S_IWUSR,
			    "/tmp/vga%d", cpuid );

	x->base_y = 0;

#ifdef ENABLE_CURSES
	init_curses ( );
	print_menu ( );
	x->subwin = create_subwin ( );
#endif
}
开发者ID:kkaneda,项目名称:vm,代码行数:17,代码来源:vga.c


示例13: main

 /**
 ****************************************************************************************
 * @brief  Main routineof the DA14580 Peripheral Examples Functions
 * DA14580 Peripherals Udage Examples
 *        - UART
 *        - SPI Flash
 *        - Boot From SPI flash
 *        - EEPROM
 *        - Timers
 *        - Battery Level Indication - ADC
 *        - Quadrature
 *        - Buzzer
 * Due to HW Development Kit limitations, user must select one of the follwoing configuartion for UART, SPI, I2C.
 * Addicional Hardware (SPI, EEPROM boadrs) or Hardware modification may needed for some tof the tests. 
 * More information in the file periph_setup.h, Application Notes, and User Guide for DA14580
 *        - UART only  ( No HW modifications on rev C2 motherboard, No additional hardware)
 *        - SPI Flash with UART (HW modifications & additional Hardware needed , SPI_DI_PIN on the additional SPI / EEPROM daughterboard )
 *        - Boot From SPI Flash with UART  (HW modifications & additional Hardware needed, (UART TX) )
 *        - Boot From SPI Flash without UART (Additional Hardware needed)
 *        - Boot From EEPROM with UART (Additional Hardware needed)
 * 
 ****************************************************************************************
*/
int main (void)
{
	  short int index = 0;
	  char mchoice;
 
	  periph_init();
	  printf_string("\n\rDA14580 Peripheral Examples\n\r");
  	  printf_string(    "---------------------------\n\r");  
    printf_string("Before running the tests:\n\r");
    printf_string("  1) Make sure you have connected the appropriate peripheral(s).\n\r");
    printf_string("  2) Select the associated hardware configuration in 'periph_setup.h'.\n\r");
    printf_string("  3) Build.\n\r");
	printf_string("Please, refer to DA14580 Peripheral Examples User Manual\n\r");
    printf_string("for detailed instructions.\n\r");
    
	  print_menu();
	 	 
		while(1){
			if (index==1) break;
			mchoice = uart_receive_byte();
			switch (mchoice){
					case 'u': uart_test(); endtest_bridge(&index); break;
#ifdef SPI_ENABLED                 
					case 'f': spi_test(); endtest_bridge(&index); break;               
#endif //SPI_ENABLED
#ifdef EEPROM_ENABLED                
					case 'e': i2c_test(); endtest_bridge(&index); break;                
#endif //EEPROM_ENABLED                                
#ifdef QUADEC_ENABLED
					case 'q': quad_decoder_test(); endtest_bridge(&index); break;
#endif //QUADEC_ENABLED      

#ifdef BUZZER_ENABLED                
					case 't': timer0_test(); endtest_bridge(&index); break;
                    case 'p': timer2_test(); endtest_bridge(&index); break;        
#endif //BUZZER_ENABLED              
				  case 'b': batt_test(); endtest_bridge(&index); break;
				  case 'x': index=1;break;		
					default: print_input(); continue;
			};
		};
	
		printf_string("\n\r End of tests\n\r");
		while(1);
}
开发者ID:GumpYangchh,项目名称:wuzhuangbo,代码行数:68,代码来源:DA14580_examples.c


示例14: main

int main()
{
	int menu;
	ListNode *head=NULL;
	setvbuf(stdout, NULL, _IONBF, 0);
	ListNode* init_bank = (ListNode*) malloc(sizeof(ListNode));
	init_bank->bank = (Bank*) malloc(sizeof(Bank));
	init_bank->bank->amount = 50000;
	init_bank->bank->name = NULL;
	head = add_to_list(head, init_bank);
	printf("============= Initial Bank =============== \n");
	print_all_item(head);
	do
	{
		print_menu();
		menu = input_menu();

		switch (menu)
		{
		case 1:
			head = loan(head);
			break;
		case 2:
			head = repay(head);
			break;
		case 3:
			print_all_item(head);
			break;
		case 0:
			break;
		default:
			break;
		}
		printf("\n");
	} while (menu != 0);

	//delete_list(head);
  free(head->bank);
	free(head);
	head = NULL;

	printf("Bye\n");

	return 0;
}
开发者ID:hyunkim9123,项目名称:hyuntest1,代码行数:45,代码来源:dll_bank_template.c


示例15: gui_start

pj_status_t gui_start(gui_menu *menu)
{
    while (!console_quit) {
	unsigned i;
	char input[10], *p;
	gui_menu *choice;

	puts("M E N U :");
	puts("---------");
	for (i=0; i<menu->submenu_cnt; ++i) {
	    char menu_id[4];
	    pj_ansi_sprintf(menu_id, "%u", i);
	    print_menu("", menu_id, menu->submenus[i]);
	}
	puts("");
	printf("Enter the menu number: ");

	if (!fgets(input, sizeof(input), stdin))
	    break;

	p = input;
	choice = menu;
	while (*p && *p!='\r' && *p!='\n') {
	    unsigned d = (*p - '0');
	    if (d < 0 || d >= choice->submenu_cnt) {
		puts("Invalid selection");
		choice = NULL;
		break;
	    }

	    choice = choice->submenus[d];
	    ++p;
	}

	if (choice && *p!='\r' && *p!='\n') {
	    puts("Invalid characters entered");
	    continue;
	}

	if (choice && choice->handler)
	    (*choice->handler)();
    }

    return PJ_SUCCESS;
}
开发者ID:DouglasHeriot,项目名称:pjproject,代码行数:45,代码来源:main_console.c


示例16: main

int main() {
			
	int option = 0;
	
	TREE *tree;
	tree = Tree_create();
	
	/* Resgatar os dados do arquivo ao iniciar o programa */
	resgatar_dados_arquivo(&(tree->root));
	
	while(option != 6) 	{
	
		print_menu();
		
		inserir_inteiro(&option);
	
		switch(option)	{
			case 1:
				menu_cadastrar(&(tree->root));
				break;
			case 2:
				menu_consultar(tree->root);
				break;
			case 3:
				menu_excluir(tree->root);
				break;
			case 4:
				menu_mostrar_relacao(tree->root);
				break;
			case 5:
				menu_gerar_relatorio(tree->root);
				break;
			case 6:
				destroy_all(tree->root);
				exit(EXIT_SUCCESS);
				break;
			default:
				printf("\nOpcao invalida!\n");
				break;
		}	
	}

	destroy_all(tree->root);
	return 0;
}
开发者ID:CaioIcy,项目名称:Censo_IBGE_2010_em_C,代码行数:45,代码来源:main.c


示例17: main

int main() {
    //freopen("eg4-6(12412).in", "r", stdin);
    stu_num = 0;
    while (1) {
        print_menu();
        int choice;
        scanf("%d", &choice);
        switch (choice) {
        case 1:add(); break;
        case 2:Remove(); break;
        case 3:query(); break;
        case 4:printf("Showing the ranklist hurts students' self-esteem. Don't do that."); break;
        case 5:statistics(); break;
        default:return 0;
        }
    }
    return 0;
}
开发者ID:chenzhifengla,项目名称:UVa_OJ_2016,代码行数:18,代码来源:eg4-6(12412)(WA).cpp


示例18: qctrl_get

static void qctrl_get(int id)
{
    qctrl.id = id;
    if (ioctl(fd, VIDIOC_QUERYCTRL, &qctrl) == 0) {
        deal_qctrl(&qctrl);
        if (qctrl.type == V4L2_CTRL_TYPE_MENU) {
            int idx;
            struct v4l2_querymenu menu;
            for (idx = qctrl.minimum; idx <= qctrl.maximum; idx++) {
                menu.id = qctrl.id;
                menu.index = idx;
                if (ioctl(fd, VIDIOC_QUERYMENU, &menu)==0) {
                    print_menu(&menu);
                }
            }
        }
    }
}
开发者ID:commshare,项目名称:KOTI_H264_AWENC,代码行数:18,代码来源:main.c


示例19: c_entry

/*********************************************************************//**
 * @brief		c_entry: Main program body
 * @param[in]	None
 * @return 		int
 **********************************************************************/
int c_entry (void)
{
	/* Initialize debug via UART0
	 * – 115200bps
	 * – 8 data bit
	 * – No parity
	 * – 1 stop bit
	 * – No flow control
	 */
	debug_frmwrk_init();

	// print welcome screen
	print_menu();

	//Use P0.0 to test System Tick interrupt
	GPIO_SetDir(1, (1<<28), 1); //Set P0.0 as output

	_DBG("Remapping Vector Table at address: ");
	_DBH32(VTOR_OFFSET); _DBG_("");
	NVIC_SetVTOR(VTOR_OFFSET);

	/* Copy Vector Table from 0x00000000 to new address
	 * In ROM mode: Vector Interrupt Table is initialized at 0x00000000
	 * In RAM mode: Vector Interrupt Table is initialized at 0x10000000
	 * Aligned: 256 words
	 */

#if(__RAM_MODE__==0)//Run in ROM mode
	memcpy(VTOR_OFFSET, 0x00000000, 256*4);
#else
	memcpy(VTOR_OFFSET, 0x10000000, 256*4);
#endif

	_DBG_("If Vector Table remapping is successful, LED P1.28 will blink by using SysTick interrupt");
	//Initialize System Tick with 100ms time interval
	SYSTICK_InternalInit(100);
	//Enable System Tick interrupt
	SYSTICK_IntCmd(ENABLE);
	//Enable System Tick Counter
	SYSTICK_Cmd(ENABLE);

	while(1);
	return 1;
}
开发者ID:DesignByArie,项目名称:lpc17xx.cmsis.driver.library,代码行数:49,代码来源:vt_relocation.c


示例20: menu

/*Menu is the method for showing some interface for the end user to interact with*/
void menu()
{
    int option = 0;
    /*We Print the Menu navigation chart*/
    print_menu();
    scanf("%i",&option);
    /*If for selecting where we go in the program*/
    if (option ==1)
    {
        /*Call are function for reading in the files*/
        read_files();
    }
    else if (option == 2)
    {
        /*Debug method for printing out the text files left it in as it can be useful later*/
        print_linkedlists();
    }
    else if (option == 3)
    {
        /*This method is used to print out the finished, unfinished and not started competitors*/
        entrants_pos(e_times,e_entrants,e_courses,e_nodes);
    }
    else if (option == 4)
    {
        /*The function below is for getting the progress of 1 specific competitor*/
        printf("Please enter the competitor number of the competitor you would like to query\n\n");
        int i = 0;
        scanf("%i",&i);
        queary_entrant(i,e_courses,c_competitors);
    }
    else if (option == 5)
    {
        /*Sort method for the list of competitors*/
        queary_entrant(-1,e_courses,c_competitors);
        comp_sort(c_competitors);
    }
    else if (option == 6)
    {
        /*Add another time for the components to be taken into account*/
        add_time();
    }
    menu();
}
开发者ID:XeTK,项目名称:CS23710-Runners-And-Riders,代码行数:44,代码来源:main.c



注:本文中的print_menu函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ print_message函数代码示例发布时间:2022-05-30
下一篇:
C++ print_matrix函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap