标题:如何改正错误
取消只看楼主
lyy0012345
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2020-11-7
结帖率:0
已结贴  问题点数:20 回复次数:0 
如何改正错误
1>C:\Users\Administrator\source\repos\ConsoleApplication5\ConsoleApplication5\ConsoleApplication5.cpp(9,6): error C2371: “month”: 重定义;不同的基类型
1>C:\Users\Administrator\source\repos\ConsoleApplication5\ConsoleApplication5\ConsoleApplication5.cpp(8): message : 参见“month”的声明
1>C:\Users\Administrator\source\repos\ConsoleApplication5\ConsoleApplication5\ConsoleApplication5.cpp(26,11): error C2088: “<<”: 对于 class 非法
1>C:\Users\Administrator\source\repos\ConsoleApplication5\ConsoleApplication5\ConsoleApplication5.cpp(33,12): error C2088: “<<”: 对于 class 非法
1>C:\Users\Administrator\source\repos\ConsoleApplication5\ConsoleApplication5\ConsoleApplication5.cpp(36,42): error C2088: “<<”: 对于 class 非法
1>C:\Users\Administrator\source\repos\ConsoleApplication5\ConsoleApplication5\ConsoleApplication5.cpp(37,95): error C2088: “<<”: 对于 class 非法
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
    double loanamount; double annualinterestrate; double monthlypayment; double month; double currentfacevalue;  double interest; double repaidPrincipal;
    int month = 1;
    cout << "" << endl;
    cout << "Welcome to the Personal Loan System" << endl;
    cout << "========================================================================================================================" << endl;
    cout << "" << endl;
    cout << "Please enter the loan amount:";
    cin >> loanamount;
    cout << "Please enter the annual interestrate(%):";
    cin >> annualinterestrate;
    cout << "Please enter the monthlypayment:";
    cin >> monthlypayment;
    cout << "" << endl;
    cout << "Month"  << setw(20) <<"Current face value" << setw(20) << "Interest"  << setw(25) << "Repaid Principal" << endl;
    cout << "================================================================================================================" << endl;
    currentfacevalue = loanamount;
    interest = loanamount * annualinterestrate * 1 / 1200;
    repaidPrincipal = monthlypayment - interest;
    cout <<""<< month << setw(20) << "$" << currentfacevalue << setw(20) << "$" << interest << setw(25) << "$" << repaidPrincipal << endl;
    while (currentfacevalue >= repaidPrincipal)
    {
        month += 1;
        currentfacevalue -= repaidPrincipal;
        interest = loanamount * annualinterestrate * 1 / 1200;
        repaidPrincipal = monthlypayment - interest;
        cout <<""<< month << setw(20) << "$" << currentfacevalue << setw(20) << "$" << interest << setw(25) << "$" << repaidPrincipal << endl;
        if (currentfacevalue < repaidPrincipal)
        {
            cout << "Remaining Balance in month " << month << "=" << currentfacevalue << endl;
            cout << "(Note: The remaining balance" << currentfacevalue << "with settled in the month " << month << "!)";
        }
    }
搜索更多相关主题的帖子: cout double Users cpp the 
2020-11-07 13:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-503803-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019402 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved