Пример #1
0
int main() {
	int option, execute = true;
	main_menu();

	while (execute) {
		option = readOption();

		switch (option) {
			case 0:
				system("clear");
				main_menu();
			break;

			case 1:
				while (substituitionCipher());
			break;

			case 2:
				while (transpositionCipher());
			break;

			case 3:
				while (productCipher());
			break;

			case 4:
				execute = false;
			break;
		}
		
	}

	return 0;
}
main_menu(){
    system("cls"); //se windows
    printa_topo();
    animate("\n\n\t1 - Jogar\n", 5);
    animate("\t2 - Instrucoes\n", 5);
    animate("\t3 - Creditos\n", 5);
    animate("\tQ - Sair\n", 5);
    printf("\n\tOpcao: ");
    scanf("%c)", &opcao_menu);
    getchar();
    switch(opcao_menu){
case '1':
    break;

case '2':
    printa_instrucoes();
    break;

case '3':
    chama_creditos();
    break;

case 'Q':
case 'q':
    exit(0);
    break;

default:
    printf("\nOpcao invalida! \nPressione <ENTER> para continuar\n");
    getchar();
    main_menu();
    }
}
Пример #3
0
void menu_palindrome()
{
    int num;
    puts("Definition of palindrome:");
    puts("1. Input a number");
    puts("2. Help");
    puts("9. Back to main menu");
    puts("0. Exit");
    printf(">>> ");
    if (scanf("%d", &num) == 1)
    {
        switch (num)
        {
        case 0:
            break;
        case 1:
            input_palindrome(); menu_palindrome(); break;
        case 2:
            help_palindrome(); menu_palindrome(); break;
        case 9:
            main_menu(); break;
        default:
            puts("Error! Invalid number.\n"); menu_palindrome(); break;
        }
    }
    else
    {
        puts("Error! Input a number.\n");
        __fpurge(stdin);
        menu_palindrome();
    }
}
int main(int argc, char * argv[])
{

	// Phase 1
	int selection=0;
	int error_code = NO_ERROR;

	while (selection != EXIT_SEL)
	{
		selection = main_menu();
		switch (selection)
		{
			case FILE_SEL:
			{
				FILE * fid;
				file_main_menu(fid);
				selection = 0;
				break;
			}
			/*case EDIT_SEL: edit_menu();

			case SEARCH_SEL: search_menu();
			case COMPUTE_SEL: compute_menu();
			case REPORT_SEL: report_menu();
			*/
		}
	}
	clear_screen();
	printf("Thank you for using StatPac. Goodbye.\n");
	fflush(stdout);

	return 0;
}
Пример #5
0
void menu_phrases()
{
    int num;
    puts("Inspection of phrases:");
    puts("1. Input text from console");
    puts("2. Input text from files");
    puts("3. Help");
    puts("9. Back to main menu");
    puts("0. Exit");
    printf(">>> ");
    if (scanf("%d", &num) == 1)
    {
        switch (num)
        {
        case 0:
            break;
        case 1:
            input_console_phrases(); menu_phrases(); break;
        case 2:
            input_file_phrases(); menu_phrases(); break;
        case 3:
            help_phrases(); menu_phrases(); break;
        case 9:
            main_menu(); break;
        default:
            puts("Error! Invalid number.\n"); menu_phrases(); break;
        }
    }
    else
    {
        puts("Error! Input a number.\n");
        __fpurge(stdin);
        menu_phrases();
    }
}
Пример #6
0
/**
  * xcom.IApplication entry point. 
  *
  * @return XC_OK
  *
  */
xc_result_t
application_start (
   xc_handle_t importHandle,
   void (* Start_result) (
      xc_handle_t importHandle,
      xc_result_t result,
      void *user_data
   ),
   void (* Start_error) (
      xc_handle_t importHandle,
      xc_result_t result,
      void *user_data
   ),
   void *user_data
) {
   printf (
      "\n"
      "xCOM Test Driver\n"
      "\n"
   );
   while (main_menu () == true);

   if (Start_result != NULL) {
      Start_result (importHandle, XC_OK, user_data);
   }

   return XC_OK;
}
Пример #7
0
//个人信息页面
static void userinfo_menu(){
	int index=1;
	char commend[1];
	erase();
	cbreak();
	noecho();
	mvprintw(3 ,25, "%s", " 欢迎访问模拟铁路订票系统!");
	mvprintw(5 ,25, "%s", " 个人资料:");
	mvprintw(7, 30, "a. 用户 id :%d", static_message.userinfo_data.uid);
	mvprintw(8, 30, "b. 用户名:%s", static_message.userinfo_data.u_name);
	mvprintw(9, 30, "c. 性别:%s", static_message.userinfo_data.sex);
	mvprintw(10, 30, "d. 电话号码:%d", static_message.userinfo_data.phone_num);
	mvprintw(11, 30, "e. 邮箱:%s", static_message.userinfo_data.email);
	mvprintw(13, 30, "%s", "1. 修改个人资料");
	mvprintw(13, 50, "%s", "2. 返回上一页");
	refresh();
	while(index){
		commend[0]=getch();
		switch(commend[0]){
			case '1':
				echo();
				nocbreak();
				modify_userinfo_menu();
				index=0;
				break;
			case '2':
				echo();
				nocbreak();
				main_menu();
				index=0;
				break;
			default: mvprintw(15, 30, "%s", "无效的命令!"); break;
		}
	}
}
Пример #8
0
main(){
	
	system("cls");
	main_menu();
	getch();

}
Пример #9
0
void menu_inch_to_cm()
{
    int num;
    puts("Translate inches to meters:");
    puts("1. Input inches");
    puts("2. Help");
    puts("9. Back to main menu");
    puts("0. Exit");
    printf(">>> ");
    if (scanf("%d", &num) == 1)
    {
        switch (num)
        {
        case 0:
            break;
        case 1:
            input_inch_to_cm(); menu_inch_to_cm(); break;
        case 2:
            help_inch_to_cm(); menu_inch_to_cm(); break;
        case 9:
            main_menu(); break;
        default:
            puts("Error! Invalid number.\n"); menu_inch_to_cm(); break;
        }
    }
    else
    {
        puts("Error! Input a number.\n");
        __fpurge(stdin);
        menu_inch_to_cm();
    }
}
Пример #10
0
void main_menu(){
	
	int choice;
	system("cls");
	system("COLOR 1C"); 		//selecting color of background and text to be displayed
 	printf("\n-----START MENU-----");
 	printf("\n1 : Play with X");
 	printf("\n2 : Play with O");
	printf("\n3 : Exit");
 	printf("\nEnter your choice:>  ");
 	scanf("%d",&choice);
 	turn = 1;
 	
	switch (choice){
 		
  		case 1:
   			player = 1;
   			computer = 0;
   			player_1();
   			break;
  		case 2:
   			player = 0;
   			computer = 1;
   			begin_game();
   			break;
  		case 3:
   			exit(1);
  		default:
   			main_menu();
 }
}
Пример #11
0
// View the total of an account
void Bank::customer_total() {
	cout << "--View the Total of Your Account--" << endl << endl;
	cout << "This menu will allow you to view the total of any of your accounts." << endl;
	int account;
	cout << "Account to view total of: "; cin >> account;
	vector<Account*>::const_iterator account_iter;
	vector<Customer*>::const_iterator customer_iter;
	bool match = false;
	for (account_iter = pAccounts.begin();
		account_iter != pAccounts.end(); ++account_iter) {
		if ((*account_iter)->getNumber() == account) {
			for (customer_iter = (*account_iter)->getOwners().begin();
				customer_iter != (*account_iter)->getOwners().end();
				++customer_iter) {
				if ((*customer_iter)->getId() == current_user) {
					match = true;
					double total = (*account_iter)->calculate_total();
					cout << "Account Number: " << (*account_iter)->getNumber() << " " << " Account Total: $" << total << endl << endl;
				}
			}
		}
	}
	if (!match) {
		cout << endl << "You do not own this account or this account does not exist." << endl << endl;
	}
	cout << "Enter 1 View Another Total for a Different Account." << endl;
	cout << "Enter 0 to Return to the Main Menu." << endl;
	int option = get_input();
	switch (option) {
	case 0:
		main_menu();
	case 1:
		customer_total();
	}
}
Пример #12
0
void Sys_Quit()
{
	char newtime[100];
	FILE* pf3 = fopen("log.txt","a+");
	char ch[10] = "q";
	while (NOTNEED)
	{
		printf("确定退出呵呵词典?(y/n)\n");
		scanf("%s", ch);
	}
	if (0 == strcmp(ch, "y"))
	{
		int i;
		strcpy(newtime , timeinfo());
		fprintf(pf3,"%s",newtime);
		fprintf(pf3, "%s\n", "退出系统");
		fclose(pf3);
		printf("%s","\033[1H\033[2J");
		printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n\n");
		printf("\t\t谢谢使用!\n\n\n\n");
		printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
		for (i=0; i<100000000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n");
		printf("\t\t谢谢使用!\n\n\n");
		printf("     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
		for (i=0; i<4000000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n\n          ~~~~~~~~~~~~~~~~~~~~~\n\n");
		printf("\t\t谢谢使用!\n\n");
		printf("\n\n\n          ~~~~~~~~~~~~~~~~~~~~~~\n");
		for (i=0; i<4000000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n\n\n\n               ~~~~~~~~~\n");
		printf("\t\t谢谢使用!\n");
		printf("               ~~~~~~~~~\n");
		for (i=0; i<4000000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n\n\n\n                 ~~~~~\n");
		printf("\n                 ~~~~~\n");
		for (i=0; i<13000000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n\n\n\n     _____________________________\n");
		for (i=0; i<2500000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n\n\n\n          ___________________\n");
		for (i=0; i<2000000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n\n\n\n               _________\n");
		for (i=0; i<2000000; i++);
		printf("%s","\033[1H\033[2J");
		printf("\n\n\n\n                    *\n");
		for (i=0; i<4000000; i++);
		printf("%s","\033[1H\033[2J");
		exit(0);
	}
	else
		main_menu();
		
}
Пример #13
0
void erasure_tool_run() {
    keyboard_register_key_down(handle_down);

    console_clear();
    console_puts("Welcome to K-OS!\n\nCopyright (c) 2013 Keeley Hoek\nAll rights reserved.\n\n");

    console_puts("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n");
    console_puts("ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n");
    console_puts("WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n");
    console_puts("DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\n");
    console_puts("ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n");
    console_puts("(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n");
    console_puts("LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n");
    console_puts("ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n");
    console_puts("(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n");
    console_puts("SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n");

    console_puts("\n\n\n\n\n\n\n");
    console_puts("If you do not agree to the above terms TURN THE COMPUTER OFF NOW.\n");
    console_puts("If you do agree to the above terms press enter to continue.");

    beep();

    wait_for_enter();

    main_menu();
}
Пример #14
0
int main()
{
    int ret = EXIT_SUCCESS;
    
    initscr();
    start_color();
    cbreak();
    nonl();
    noecho();
    keypad(stdscr, TRUE);

    if (viewer_init_colors())
    {
        ret = EXIT_FAILURE;
        goto uninit;
    }

    if (main_menu())
        ret = EXIT_FAILURE;

uninit:
    viewer_restore_colors();
    keypad(stdscr, FALSE);
    echo();
    nocbreak();
    endwin();

    return ret;
}
Пример #15
0
/**
 * @brief Main function for the game.
 * @param argc count of arguments provided to the game.
 * @param argv an array of the arguments provided to the game.
 * @return always 0.
 */
int main(int argc, char *argv[])
{	
  Init_All();
  done = 0;
  do
  {
	if(gameState == 0)
	{
		  main_menu();
	 }
	else if(gameState == 1)
	{
		levelOne();
	}
	else if(gameState == 2)
	{
		levelTwo();
	}
	else if(gameState ==3)
	{

	}
  }while(!done);
  
  slog("got here");
  exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
  SDL_DestroyTexture(bullet_Texture);
  return 1;
}
Пример #16
0
int main(void)
{
  //test();
  puts("\nWelcome to our warehouse program!");
  main_menu();
  return 0;
}
Пример #17
0
int main(void) {
	struct item *ptr = NULL;
	ptr = main_menu(ptr);
	if(ptr != NULL) {
		ptr = del_list(ptr);
	}
	return 0;
}
Пример #18
0
int main(){
	print_welcome();
	print_menu();
	while(1){
		main_menu();
	}
	return 0;
}
Пример #19
0
int main()
{
  std::list<compte_normal *> l_compte;

  read_file(l_compte);
  main_menu(l_compte);
  save_data(l_compte);
}
Пример #20
0
void
CmdInterface::run(PhoneBook & pb)
{
    cout << "          Phone Book 0.1 By JackalDire          \n";
    
    main_menu();

    char cmd;
    do
    {
        cout << "cmd>";
        cmd = getCommand();
        switch (cmd)
        {
            case '1': onAddRecord(pb); pause(); main_menu();break;
            case '2': onEditRecord(pb); pause(); main_menu();break;
            case '3': onSearchRecord(pb); pause(); main_menu();break;
            case '4': onDelRecord(pb); pause(); main_menu();break;
            case '5': show(pb); pause(); main_menu();break;
            case '9': main_menu(); break;
            case '0': cout << "Exit.\n"; break;
            default:
                cout << "Error Command!\n";
                cin.clear();
                cin.sync();
                break;
        }
    }
    while(cmd != '0');
}
void chama_creditos(){
    system("cls"); //se windows
    printa_topo();
    animate("\nimagok: #Coding, #Compiling, #Complaining, #low_class_jokes.lib\n", 10);
    animate("Spy: #Coding + #Insulting = #Consulting\n", 10);
    animate("\nPress <ENTER> to return to the main menu", 10);
    getchar();
    main_menu();
}
Пример #22
0
int main(int argc, char **argv)
{
  CLEAR_SCREEN;
  printf(WELCOME_MSG);

  main_menu();

  return EXIT_SUCCESS;
}
Пример #23
0
int main(int argc, char **argv) {
	strcpy(sbstr, "loading...");

	do_init();

	main_menu();

	exit(0);
}
Пример #24
0
static void
setsound ()
{
#ifdef SOUND
  if (sndinit)
    ssound = !ssound;
#endif
  main_menu ();
}
Пример #25
0
int main(int argc, char *argv[])
{
    system("clear");
    
    while(1) {
        main_menu(argc, argv);
    }

    return 1;
}
Пример #26
0
Файл: main.c Проект: kad4/snake
int main(int argc, char **argv)
{
    init_allegro_elements();

    if (main_menu()==0)
    {
        exit_game();
        return 0;
    }
}
Пример #27
0
/*
Funcao main apenas pega a opcao do usuario e direciona o programa para a funcao correspondente
Variaveis:
	opc- opcao digitada pelo usuario
	btree- arvore binaria
	reg- possivel arquivo de registros ja existente
*/
int main(void) {
	int opc;
	arvoreb_t *btree;

	btree = createArvoreB();
	if (file_exists(FILE_REG) && isEmptyArvoreB(btree)) { //arquivo de registros ja existe e deve ser carregado
		FILE *reg;
		reg = fopen(FILE_REG, "r");
		Load_reg(reg, btree);
		fclose(reg);
	}

	opc = 1;
	while (opc) {
		clearScreen();
		main_menu();
		opc = _scanf_int();
		printf("==========================================================\n");

		switch (opc) {
			case 1:
				Insere_usuario(btree);
				break;

			case 2:
				Remove_usuario(btree);
				break;

			case 3:
				Busca_usuario(btree);
				break;

			case 4:
				clearScreen();
				printArvoreB(btree);
				system_pause();
				break;

			case 5:
				clearScreen();
				printf("Fechando o programa...\n");
				freeArvoreB(btree);
				opc = 0;
				break;

			default:
				printf("Opcao invalida, tente novamente\n");
				opc = 1; //Garante que o usuario podera escolher novamente
				system_pause();
				break;
		}

	}
	return 0;
}
Пример #28
0
int main(int argc, char** argv)
{
  app.status = 1;
  //char buf[256];

  //bool conection_open = false;

    if ( (argc < 2) || 
  	     ((strcmp("/dev/ttyS0", argv[1])!=0) && 
  	      (strcmp("/dev/ttyS4", argv[1])!=0) )) {
      printf("Usage:\tnserial SerialPort\n\tex: nserial /dev/ttyS0\n");
      exit(1);
    }

        set_basic_definitions(3, 3, argv[1], BAUDRATE);

    char anws=' ';
    	while (anws != 'f'){
	   anws=main_menu(APP_STATUS_RECEIVER);
	  		switch (anws){

		case 'a':
			if (connect() == 0)
			{
				//conection_open = true;
				if (testread() == 0)
				{
					llclose(app.fd);
					//if (llclose() == OK)
					//{
					close_tio(app.fd);
					//conection_open = false;
					//}
					sleep(9);
				}
			}
			break;
		case 'b':printf("\nNOT IMPLEMENTED");//reconnect();
			break;
		case 'c':select_config(config);
			break;
		case 'd': printf("\nNOT IMPLEMENTED");//if (receiver != 0) choosePicture2Send();
			break;
		case 'e':
			datalink_log = get_occurrences_log();
			show_prog_stats(datalink_log->num_of_Is, datalink_log->total_num_of_timeouts, datalink_log->num_of_REJs, APP_STATUS_RECEIVER);
			break;
		case 'f':printf("\nNow exiting...\n"); sleep(1);
			break;
		default: printf("\nNo valid command recognized."); sleep(1); break;
			}
	}

    return 0;
}
Пример #29
0
Файл: FED.C Проект: MegaGod/TW
void fed( void ) {
	cufontpath[0] = '\0';
	cuwordpath[0] = '\0';
	cuprintpath[0] = '\0';

	matrix_image = ( char* ) malloc( 1 );
	char_block_image = ( char* ) malloc( 1 );
	center_x = 320 + align;
	center_y = 347 / 2;
	main_menu( );
}
Пример #30
0
void
init_menu ()
{
  mx1 = 10;
  mx2 = MAPWIDTH - 10;
  my2 = 10;
  my2 = MAPHEIGHT - 10;
  ssound = sound;
  playertext[1] = nrockets + '0';
  main_menu ();
}