Ejemplo n.º 1
0
void menu() {
	int option;
	FrList list = 0;
	do {
		printf("\nLINKED LIST MENU: Fraction"\
			"\n1. Displaying current list"\
			"\n2. Inserting"\
			"\n3. Removing"\
			"\n4. Quit");
		printf("\nEnter the option (1 or 2): ");
		scanf("%d", &option);

		switch (option) {
		case 1:
			displayListTylerHill(list);
			break;
		case 2:
			insMenu(&list);
			break;
		case 3:
			remMenu(&list);
			break;
		case 4:
			printf("\nGood work have fun goodbye \n");
			break;
		default:
			printf("\nWRONG OPTION ...\n");
		}
	} while (option != 4);
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: vsctiago/LP
int main(int argc, char** argv) {
    int opt, opti, insnr = 0, stdnr = 0;
    Instructor instructors[INS_MAX];
    Student students[STD_MAX];
    Schedule schedule[SCH_LINE][SCH_COL];
    
    do{
        menu();
        printf("Option?: ");
        scanf("%d", &opt);
        
        if(opt == 1){
            students[STD_MAX] = readStdFile(students);
            stdMenu();
            printf("Option?: ");
            scanf("%d", &opti);
            if(opti == 1){
                stdnr = stdVerifyPos(students, STD_INIT);
                if(stdnr != EOF){
                    stdAdd(students, stdnr);
                    saveStdFile(students);
                }    
            }else if(opti == 2){
                stdModify(students);
                saveStdFile(students);
            }else if(opti == 3){
                stdList(students);
            }else if(opti == 4){
                stdRemove(students);
                saveStdFile(students);
            }
        }else if(opt == 2){
            instructors[INS_MAX] = readInsFile(instructors);
            insMenu();
            printf("Option?: ");
            scanf("%d", &opti);
            if(opti == 1){
                insnr = insVerifyPos(instructors, INS_INIT);
                if(insnr != EOF){
                    insAdd(instructors, insnr);
                    saveInsFile(instructors);
                }    
            }else if(opti == 2){
                insModify(instructors);
                saveInsFile(instructors);
            }else if(opti == 3){
                insList(instructors);
            }else if(opti == 4){
                insRemove(instructors);
                saveInsFile(instructors);
            }
        }else if(opt == 3){
        }
    } while(opt != 4);
    saveInsFile(instructors);
    saveStdFile(students);
    
    return (EXIT_SUCCESS);
}