C++ lessons

Status
Not open for further replies.

gab00n

In Runtime
Messages
287
I have some basic c++ stuff sitting around that i will post here, i will have to write lesson 1 again as i lost it. I am also going to start on some new ones. These lessons are intended for novices.
 
Hi. I just wanna know if the formula for the monthly payment in lesson3 is correct? supposedly the answer would be 1072.30 when i use the test inputs right? I tried it in a calculator and my answer is 140.52. My program also produce the same result... I wonder if that is correct? here's my code:

#include <iostream.h>
#include <stdlib.h>
#include <math.h>
int main()
{
char surname[20],firstname[20];
double monthlyPmt,rate,term,LoanAmt,Frate,Fterm;
cout<<"This program will compute for our monthly payment.";
cout<<"\nKindly fill up necessary fields.";
cout<<"\nSurname :";
cin>>surname;
cout<<"First name :";
cin>>firstname;
cout<<"Loan Amount :";
cin>>LoanAmt;
cout<<"Term (years) :";
cin>>term;
cout<<"Rate :";
cin>>rate;
Frate= (rate/100)/12;
Fterm = term*12;
monthlyPmt =( Frate*(pow(1+Frate,Fterm)) / pow(1+Frate,Fterm-1) ) * LoanAmt;
cout<<monthlyPmt;
system("PAUSE");
return 0;
}

thanks :)
 
monthlyPmt =( Frate*(pow(1+Frate,Fterm)) / (pow(1+Frate,Fterm)-1) ) * LoanAmt;

See if that formula works.
 
No idea. :) I hope gab00n will post more tutorials, like tetris like game. And some problem solving of course. :)
 
Yeah i have to write the first lesson again, and i will write some more soon. This weekend i will have some free time so check in on Sunday.
 
Thanks. I'll make sure to check that out. May I request for simple game making tutorials and simple AI. Like tic tac toe? Thanks. Uou're the best :)
 
Status
Not open for further replies.
Back
Top Bottom