#include <iostream>#include <cmath>//#include "RegPay.cpp"using namespace std;void Menu(void);void RegPay(void);void PrimePrint(void);void RegPay(void){ //program for calculating the interest //These vars were the original design double Principal; //original principal double IntRate; //Interest rate double PayPerYear; //Payments per year double NumYears; //Number of years to pay off double Payment; //regular payment double numer, denom; //temp variables double b, e; //base and exponent for call to pow() //These two vars are added for the assignment double TotalPay; //the total payback for the loan double TotalInt; //the total amount of interest over the loan's life-span // Input phase cout << "===[Interest calculation program]===\n" << endl; cout << "Enter principal: "; cin >> Principal; cout << "Enter interest rate in % (i.e. 12,5% = 12.5): "; cin >> IntRate; IntRate /= 100; //convert readable interest to mathmetical value cout << "Enter the amount of payments per year: "; cin >> PayPerYear; cout << "Enter the number of years: "; cin >> NumYears; // Processing phase numer = IntRate * (Principal / PayPerYear); //resolve the formula for the numer e = -(PayPerYear * NumYears); //resolve the exponential part for the denominator b = (IntRate / PayPerYear) + 1; //resolve the base for the denominator denom = 1 - pow(b, e); //make the final resolution for the denominator Payment = numer / denom; //store the regular payment TotalPay = Payment * PayPerYear * NumYears; //calculate the total payment over the loan's life span TotalInt = TotalPay - Principal; //calculate the amount paid for pure interest //Output phase cout << "\nRegular payment is: " << Payment << endl; cout << "\nTotal payment will be: " << TotalPay << endl; cout << "Total amount of interest paid will be: " << TotalInt << endl;} void PrimePrint(void){ bool bPrime; //this is the flag if the number is a prime bool bFraction; //This will flag if there is a fraction int iPrimeCols = 10; //sets the amount of columns to display int iCurPCol = 0; //sets the first column int iMaxPrimes = 100; //sets the default max primes cout << "===[Prime number printer]===\n" << endl; cout << "Enter the approximate number of your highest desired prime number: "; cin >> iMaxPrimes; cout << "\n" << endl; for(int iCount = 1; iCount <= iMaxPrimes; iCount++){ if (iCount > 1){ //exclude 1 as a Prime posibility if((iCount / 1) == iCount && (iCount / iCount)) //set to true for base rule for Prime bPrime = true; //start trying to divide for(int iDiv = 2; iDiv < iCount; iDiv++){ bFraction = iCount % iDiv; //check if devision has a fraction if(!bFraction) //if the division has no fraction after 1 and before itself bPrime = false; } if(bPrime){ cout << iCount << "\t"; iCurPCol++; if (iCurPCol == iPrimeCols){ cout << endl; iCurPCol = 0; } } } }}void main(void){ char cMenu for(;;){ do{ cout << "===[Welcome to DrunCo-PsyKen's first training application]===" << endl; cout << "\n\nEnter a selection:\n" << endl; cout << "1>Regular Payment Calculation" << endl; cout << "2>Prime Number Printer" << endl; cout << "q>Exit" << endl; cin >> cMenu; } while (cMenu < '1' || cMenu > '2' && cMenu !='q'); if (cMenu == 'q') break; cout << endl; switch(cMenu){ case '1': RegPay(); break; case '2': PrimePrint(); break; } }}/*Hey fs, this is that first program I made from the lesson I mentioned.Just before I realized it that you gave me this link, I updated part of it from the new lesson.My compiler would run the program and close the application before you could view it, so I first had to made a function to prevent it from closing off.Later I changed it into a menu... which you now see changed to the updated switch case statement in an infinite loop.main would call Menu(); and it looked like this:void Menu(void){ int iMenuChoise; while(iMenuChoise != 'q'){ cout << "\n\nEnter a selection:\n\n1>Regular Payment Calculation\n2>Prime Number Printer\nq>Exit" << endl; cin >> iMenuChoise; if(iMenuChoise == '1') RegPay(); if (iMenuChoise == '2') PrimePrint(); }}And if you look closely at the start of this file >.> you see I made a mistake in the update by not removing the Menu() prototype declaration. XD*/