Post-processing becomes a useful function, which is recorded here as a demo.
#include <iostream> using namespace Std;int main () {int type;double money, period, rate, Interest;cout << "Welcome to make Use the interest calculator! "<< endl;cout <<" Please enter Deposit Amount: "Cin >> money;cout <<" ====== deposit term ====== "<< endl;cout <<" 1.3 months "<< endl;cout <<" 2. 6 months "<< endl;cout <<" 3. One year "<< endl;cout <<" 4. Two years "<< endl;cout <<" 5. Three years "<< endl;cout <<" 6. Five years "<< endl;cout <<" Please enter the term of deposit: "; Cin >> type;if (type >= 1 && type <= 6) {switch (type) In if the switch is embedded in the case of the 1:period = 0.25;rate = 0.031;break;case 2:period = 0.5;rate = 0.033;break;case 3:period = 1;ra Te = 0.035;break;case 4:period = 2;rate = 0.044;break;case 5:period = 3;rate = 0.05;break;case 6:period = 5;rate = 0.055;b Reak;} Interest = money * Period * rate;cout << "interest due:" << interest << "Yuan, principal sum total" << interest + money < ;< "Yuan. "<< Endl;} Elsecout << "Choose the Deposit type Error! "<< EndL;cout << "Thank you for your use, welcome to the next visit!" "<< Endl;system (" pause "); return 0;}
Term Deposit Interest Calculator version-c++