void main() { cout.precision(2); //设置精度 cout.setf(ios::fixed|ios::left); while(1) { switch(showMainmenu()) { case 1 :cash(); break; case 2 :stackmgr(); break; case 3 :reports(); break; case 4 :showmsg(); exit(0); break; } } }
void main () { startDay(sFile2); populateTextfile(sFile1); int i; do { printf("----------------------------------------------------\n"); printf("Push 1 to sell item.\n"); printf("Push 2 to return item.\n"); printf("Push 3 to search stock on system.\n"); printf("Push 4 to update stock.\n"); printf("Push 5 to print all stock to screen.\n"); printf("Push 6 to see cash in till for today only.\n"); printf("Push 7 or higher to quit the program.\n"); printf("?: "); scanf("%d", &i); switch (i) { case 1: printf("\n----------------------------------------------------\n"); sellItem(sFile1, sFile2); printf("----------------------------------------------------\n\n"); break; case 2: printf("\n----------------------------------------------------\n"); returnBook (sFile1, sFile2); printf("----------------------------------------------------\n\n"); break; case 3: printf("\n----------------------------------------------------\n"); stockSwitch(); printf("----------------------------------------------------\n\n"); break; case 4: printf("\n----------------------------------------------------\n"); updateStock(); printf("----------------------------------------------------\n"); break; case 5: printf("\n----------------------------------------------------\n"); printItem(sFile1); printf("----------------------------------------------------\n\n"); break; case 6: printf("\n----------------------------------------------------\n"); cash(sFile2); printf("----------------------------------------------------\n\n"); break; case 9: rofl(); break; } } while (i<7 && i!=9); populateTextfile(sFile1); endStatement(sFile2); }