How do I reprint the menu on blank screen
here is the while loop
while(option != 4)
{
printf("Welcome to the Amortization Calculator\n");
printf("please type the number of your chosen option:\n\n");
printf("(1)Calculate Loan Amount\n(2)Calculate Payment Amount\n"
"(3)Calculate Number of Months\n(4)Quit\n\n");
scanf("%d", &option);
char1 = (option == 1) ? ‘A’ : (option == 2) ? ‘B’ : (option == 3) ? ‘C’ : (option == 4) ? ‘D’:
char1;
switch(char1)
{
case ‘A’: printf("You chose option: 1\n\n");
getLoanAmountInput(&yearInterestRate, &amountOfPayments, &numMonths);
break;
case ‘B’: printf("You chose option: 2");
getPaymentsInput(&yearInterestRate, &amountOfLoan, &numMonths);
break;
case ‘C’: printf("You chose option: 3");
getNumberOfPaymentsInput(&yearInterestRate, &amountOfLoan, &amountOfPayments);
break;
case ‘D’: return EXIT_SUCCESS;
break;
default: printf("You didn’t choose");
break;
}
Yes, system("cls").
That’s 1 of 2 ways Microsoft recommends. And the second way looks like way too much work. (See link).
Just out of curiosity, why did you go through the work of converting option to a letter?
Why not just write:
switch(option)
…
case 1: printf("You chose option: 1\n\n");
…
Code would be cleaner (Nested ternary operators make me cringe
use system ("cls") to clear the screen
References :
Yes, system("cls").
That’s 1 of 2 ways Microsoft recommends. And the second way looks like way too much work. (See link).
Just out of curiosity, why did you go through the work of converting option to a letter?
Why not just write:
switch(option)
…
case 1: printf("You chose option: 1\n\n");
…
Code would be cleaner (Nested ternary operators make me cringe
References :
http://support.microsoft.com/kb/99261