写一个C ++程序,它将计算债务的月度余额。 [英] Write a C++ program which will calculate the monthly balance of a debt.

查看:67
本文介绍了写一个C ++程序,它将计算债务的月度余额。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个C ++程序来计算债务的每月余额。





应该看起来像这样:





起始余额:1000

利率(APR):8

每月付款:100



月付款利息余额

----------------- -----------------------

1 100.00 6.67 906.67

2 100.00 6.04 812.71
3 100.00 5.42 718.13

4 100.00 4.79 622.92

5 100.00 4.15 527.07

6 100.00 3.51 430.58

7 100.00 2.87 333.45

8 100.00 2.22 235.68

9 100.00 1.57 137.25

10 100.00 0.91 38.16

11 38.42 0.25 0.00



总计支付:1038.42



我尝试过的事情:



我需要帮助启动并编写它

I need to write a C++ program that calculates the monthly balance of a debt.


It should kinda look like this:


Starting balance: 1000
Interest rate (APR): 8
Monthly payment: 100

Month Payment Interest Balance
----------------------------------------
1 100.00 6.67 906.67
2 100.00 6.04 812.71
3 100.00 5.42 718.13
4 100.00 4.79 622.92
5 100.00 4.15 527.07
6 100.00 3.51 430.58
7 100.00 2.87 333.45
8 100.00 2.22 235.68
9 100.00 1.57 137.25
10 100.00 0.91 38.16
11 38.42 0.25 0.00

Total amount paid: 1038.42

What I have tried:

I need help starting it and writing it

推荐答案

除了之前的评论,我还提供这个...



将问题分解为'咬大小块'。



您需要,例如



a)代码/例程获取



In addition to the previous comments, I offer this...

Break the problem down into 'bite size pieces'.

You need, for example

a) code/a routine to get

Quote:

起始余额:1000

利率(APR): 8

每月付款:100

Starting balance: 1000
Interest rate (APR): 8
Monthly payment: 100




来自用户的
- 你知道怎么做才能做到这一点?



在最基本的方法中,你



cout<< 为用户提供一些信息,可能输入一个数字,然后输入

int someVarCalledI = 0;

cin>> someVarCalledI;



但是如果你打算这样做3次,你也可以编写一个函数来为用户提供'消息'并返回一个值(请注意你在这里使用的数字类型)



b)你需要代码来计算月份的月平衡n



c)你需要代码输出每月余额的结果



d)可能是某种循环来结合b& c



from the user - what do you know that can do this ?

in the most basic method, you

cout << "some message for the user, maybe, type a number and press enter"
int someVarCalledI = 0;
cin >> someVarCalledI;

but if you're going to do that 3 times you may as well write a function to take the 'message for the user' and return a value (be careful what numeric type you are using here)

b) You need code to calculate the monthly balance for month n

c) You need code to output the results of the monthly balance

d) possibly some sort of loop to combine b & c


我们不做你的HomeWork。

HomeWork不会测试你乞求别人做你的工作的技巧,它会让你成功思考并帮助您的老师检查您对所学课程的理解,以及您应用这些课程时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

所以,试一试,重读你的课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



作为程序员,您的工作是创建算法解决特定问题,你不能依赖别人永远为你做,所以有一段时间你必须学会​​如何。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找到数学并做出必要的调整以适应你的实际问题。



一个有趣的链接,让你开始一个新项目:系统开发生命周期 - 维基百科 [ ^ ]
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.

An interesting link to get you started on a new project: Systems development life cycle - Wikipedia[^]


这篇关于写一个C ++程序,它将计算债务的月度余额。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆