Task 8-calculate the regular repayment quota !!

Source: Internet
Author: User
/** Copyright (c) 2012, School of Computer Science, Yantai University * All Rights Reserved. * Author: Yang Chen * Completion Date: July 15, October 19, 2012 * version: V1.0 ** input Description: none * Problem description: Calculating the regular repayment quota * program output: Output payment * problem analysis: set multiple variables, replace the fraction with the variable, and use the floating point type for calculation. * Algorithm Design: */# include <iostream> # include <cmath> using namespace STD; int main () {double principal; double rate; double payperyear; double numyears; double denom; double payment; double number; Double E; Double B; cout <"input principal:"; CIN> principal; cout <"input interest rate:"; CIN> rate; cout <"Enter the number of times the loan is repaid each year:"; CIN> payperyear; cout <"loan duration:"; CIN> numyears; number = Rate * Principal/payperyear; B = (rate * payperyear) + 1; E =-(P Ayperyear * numyears); denom = 1-Pow (B, E); payment = Number/denom; cout <"payment is" <payment; return 0 ;} observation and experience: the output result is the same as that of the previous operation. My conclusion: The first time I came into contact with the floating point model, I also said that I had encountered the problem of adding a superfluous image. I didn't understand the problem clearly before, but after I understood it, I suddenly became very open !!! Park sorry. I love u!

Result:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.