Hello, everyone
I just wrote a program by using vc 2010 and it won't compile. The reason was

1>------ Build started: Project: 17, Configuration: Debug Win32 ------
1> 17.cpp
1>c:\users\yuan\documents\visual studio 2010\projects\17\17.cpp(101): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
1>17.obj : error LNK2019: unresolved external symbol "void __cdecl PrintResults(class std::basic_ofstream<char,struct std::char_traits<char> > &,float,int,float,float)" (?PrintResults@@YAXAAV?$basic_ofstream@DU?$char_traits@D@std@@@std@@MHMM@Z) referenced in function _main
1>17.obj : error LNK2019: unresolved external symbol "void __cdecl DeterminePayment(float,int,float,float &)" (?DeterminePayment@@YAXMHMAAM@Z) referenced in function _main
1>C:\Users\Yuan\documents\visual studio 2010\Projects\17\Debug\17.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Any suggestion? Thank you.


//*****************************************************************
// 17.cpp :
// Mortgage Payment Tables program
// This program prints a table showing loan amount, interest rate,
// length of loan, monthly payments, and total cost of a mortgage.
//*****************************************************************
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
using namespace std;
//Function prototypes
void PrintHeading(ofstream&);
void DeterminePayment(float, int, float, float&);
void PrintResults(ofstream&, float, int, float, float);
int main()
{
//Input variables
float loanAmount;
float yearlyInterest;
int numberOfYears;
float payment;
//Declare and open output file
ofstream dataOut;
dataOut.open("mortgage.out");
if( !dataOut )
{
cout<<"Can't open output file."<<endl;
return 1;
}
PrintHeading(dataOut);
// Prompt for and read loan amount
cout << "Input the total loan amount; "
<< "a negative value stops processing." <<endl;
cin >> loanAmount;
// Loop calculating monthly payments
while (loanAmount >= 0.0)
{
// Prompt for and read interest rate and number of years.
cout << "Input the interest reate." <<endl;
cin >> yearlyInterest;
cout << "Enter the number of years for the loan" <<endl;
cin >> numberOfYears;
DeterminePayment(loanAmount, numberOfYears, yearlyInterest, payment);
PrintResults(dataOut, loanAmount, numberOfYears, yearlyInterest, payment);
// Promote for and read loan amount
cout << "Input the total loan amount; "
<< "a negative value stops processing." <<endl;
cin >> loanAmount;
}
dataOut.close();
return 0;
}
void PrintReuslts(ofstream& dataOut, float loanAmount, int numberOfYears, float yearlyInterest, float payment)
// Prints the loan amount, number of years, yearly interest rate,
// and payment amount of file dataOut
// Precondition:
// File dataout has been opend successfully &&
// All arguments have been assigned values
// Postcondition:
// Loan amount, number of years, yearly interest rate, and
// payment have been printed on DataOut with proper
// documenttation.
{
dataOut << fixed << setprecision(2) << setw(12) << loanAmount
<< setw(12) << numberOfYears << setw(12)
<< yearlyInterest << setw(15) << payment
<< setw(12) << numberOfYears*12*payment <<endl;
}
//********************************************************************
void DeterminPayment(float loanAmount, int numberOfYears, float yearlyInterest, float& payment)
// Calculates the monthly payment for a loan amount using the
// formula for compund interest.
// Precondition:
// Arguments have been assigned values
// Postcondition:
// payment contains the monthly payment as calculated by the
// compound interest formula
{
//local variables
float monthlyRate;
int numberOfPayments;
monthlyRate = yearlyInterest / 12.00;
numberOfPayments = numberOfYears * 12;
payment = (loanAmount * pow( 1 + monthlyRate, numberOfPayments)
* monthlyRate )/
(pow( 1 + monthlyRate, numberOfPayments) - 1);
}
//********************************************************************
void PrintHeading(ofstream& dataOut) //Output file
// Prints the heading on file dataOut for each column in the table.
// Precondition:
// File dataOut has been opened successfully
// Postcondition:
// "Loan Amount", "No. Years", "Interest Rate", "Payment".
// "Total paid" have been written on file dataOut
{
dataOut<< fixed <<setprecision(2) <<setw(12) << "Loan Amount"
<< setw(12) << "No. Years" << setw(15)
<< "Interest Rate" << setw(12) << "Payment"
<< setw(12) << "Total Paid" <<endl;
}

so mate you have to read the error messages one by one and fix the
whole program.Believe me there's no another way.

And use [ code ] [ / code ] tags ,because they are nice.

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.