Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, below I have my code to implement the secant method. However I keep getti

ID: 3629404 • Letter: H

Question

Hello, below I have my code to implement the secant method. However I keep getting LNK2019 and LNK1120 and the program fails. It says its due to an unresolved external symbol but I have checked and double checked my code and can't find where it might be! I'm hoping a fresh pair of eyes can aid me :)

/*FIRST SECANT METHOD*/
#include <iostream>
#include <cmath>

using namespace std;

void Secant();
float Function(float x);

int main()
{
Secant();
}

void Secant()
{
int TOL, N;
float p0, p1, q0, q1;

cout << "Please input the first approximation: ";
cin >> p0;
cout << " Please input the second approximation: ";
cin >> p1;

cout << " Thank you! Please enter the tolerance level that you would like: ";
cin >> TOL;

cout << " Thank you! Please enter the maximum number of iterations you would like the program to run for: ";
cin >> N;

int i = 2;

q0 = Function(p0);
q1 = Function(p1);

do
{
    float p;
    p = (p1-(q1*(p1-p0)/(q1-q0)));
    if (abs(p-p1) < TOL)
{
      cout << "The program was successful after " << i << " iterations! ";
      cout << "One root of this function is: " << p;
      endl(cout);
    }

    i = i+1;

    p0=p1;
    q0=q1;
    p1=p;
    q1=Function(p);

}while(i <= N);

cout << "The method failed after N iterations, N = " << N;
endl(cout);

}

float Function(float x)
{
float result;
result = ((x*x) - 1);
return result;
}

Explanation / Answer

Dear friend your program is working fine no errors found the error u r getting is from the project u r testing he code on i.e so try openning a new project and test the code on if u need more help message me

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote