Hello everyone. Happy New Year. I've been going over last semester's book and have found that I've already allowed the basics to run away! We ended with classes, so I've gone back to just doing exercises with basic functions and I keep getting a linker on this one.:
Takes input for the amount a consumer needs to borrow(in-pocket), the interest rate, and duration of loan in months. Program should calculate the "face value" of loan (with interest) as well as monthly payment. Please excuse my sloppy code, I just don't see this:

#include <iostream>
using namespace std;

	double paid_out, rate, time, interest, in_pocket, months, monthly_payment;
	double loan_value(double rate, double time, double interest, double in_pocket);
	double payment(double monthly, double paid_out);


	        double loan_value( double rate,  double time,  double interest,  double in_pocket)
	{
		paid_out = (in_pocket) / (1 - rate * time);
		return 0;
	}
	        double payment(double months, double paid_out)
	{
		monthly_payment = (paid_out / months);
		return 0;
	}
Member Avatar for GreenDay2001

What linker errors are you getting? You have just declared the function paidout() but not defined it. And perhaps you have called it somewhere else. Also if you think thats the whole program then its wrong, you haven't written main function. That too could be a cause.

Thanks. Yes, I was trying to develop a new habit of checking for errors as I proceed, debugging as you go, because I had a bad habit of tying to write the whole thing and then the errors would be too overwhelming. Can I do this somehow without calling the functions in a main? Or won't that be possible?
Thanks
RG

What is the error? Linking errors are different than syntactical error one can't find them looking at the code.

It's resolved. I needed to write my main with function calls I guess you just get linkers without writing a call in main first?
Thanx for the help!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.