Questo topic e' stato chiuso dal moderatore.
29/10/10 14:34
div
ho fatto un progetto in c++ che simula un deposito in banca con interesse e mi da errore.
//nome:savingsAccount.h class savingsAccount { public: //costruttore savingsAccount(int,int,int,int); void annualInterestRate(int,int);//calcola interesse annuale con la percentuale stabilita void calculateMonthlyInterest();//calcola interesse mensile int getresult(); private: int savingsBalance;//soldi int month;//mesi int year;//anni int interestA;//interessi annuali int interestM;//interessi mensili }
//nome:savingsAccount.cpp #include "savingsAccount.h" savingsAccount::savingsAccount( int money,int y,int m,int perc ) { year=y; month=m; annualInterestRate(money,perc); savingsBalance=money+(interestA*year); savingsBalance=interestM*month; }//fine del costruttore void savingsAccount::annualInterestRate(int EURO,int pc) { interestA=(EURO/100)*pc; }//fine annualInterestrate void savingsAccount::calculateMonthlyInterest() { interestM=(interestA/12); }//fine calculateMonthlyInterest int savingsAccount::getresult() { return savingsBalance; }//fine getresult
//nome: main.cpp #include<iostream> #include"savingsAccount.h" using namespace std; void main() { savingsAccount a(200000,2,6,4); savingsAccount b(300000,2,6,3); cout<<"il primo deposito:"<<a.getresult()<<endl; cout<<"il secondo deposito"<<b.getresult()<<endl; }
aaa