Please I have a little problem with my project. It goes
"A polynomial of degree n is represented as
Pn(x)=A0 + a1x + a2x^2 + … + anx^n
Where a0, a1, a2, a3 , … , an are constant coefficients. Evaluation of such polynomials may be important if Pn(x) is to be computed many times for different values of x. Design and implement a program that asks for the user to enter a value for the degree of the polynomial n, and values for n+1 coefficient.
Your program should read these values and then in a loop it should prompt the user to enter the values for X and compute and print values for the polynomial. Your program should terminate execution if the last two values read for x are equal. Your program should be able to process polynomials of degree 6 or less."
So far i guess that n+1 should be an array, but i don't know what to do. Please I need help

Recommended Answers

All 5 Replies

Have you made a start coding this program? Post your source code to show that you have made some effort.

Getting the polynomial degree and the coefficients in is pretty straightforward. Then it is just a matter of evaluating the polynomial. Simple evaluation is possible, but not the best. Horner's method is better. Even better methods are also available.

Tip: You can make polynomial data structure with pointers and linked lists

Tip: You can make polynomial data structure with pointers and linked lists

How. I don't know how to use pointers

This is how far I've gone

# include <stdio.h>
# include <conio.h>
# include <math.h>

main()
{
 int N,O,arr[10],i,x,P;
 long value=0;
 printf("\n This is a program to evaluate polynomials");
 printf("\n Enter the degree of the polynomial");
 scanf("%d",&N);
 O = N + 1;
 printf("\n Enter %d values",O);
 for(i=0;i<O; i++){
 scanf("%d",&arr[i]);
    }
 }

I think you are just a beginner in C.
You MUST study pointers.
Here is one link
http://home.netcom.com/~tjensen/ptr/pointers.htm

After this you can study linked lists.

You have to learn C step by step.
You can think of your real polynomial problem as an advanced topic.

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.