للاسف كتبت كود برنامج كثيرات الحدود لكن لا يتنفذ بالشكل الصحيح
ياليت تبيون لي اخطائي لو تكرمتوا وجزاكم الله خيرا
وهذا هو الكود
#include <iostream.h>
void creat();
void insert();
void add();
void print();
struct node{
int x,y;
node*next;};
node * mynode;
node *p;
node*s;
int n,i,a,b;
void creat()
{mynode=NULL;}
void insert()
{p=new node;
p->x=a;
p->y=b;
if (p->y==0)
{delete p;
n=n-1;}
p->next=mynode;
mynode=p;
}
void add()
{ node *z=new node;
z->x=a;
z->y=b+p->y;
if (z->y==0)
{delete z;
n=n-1;}
z->next=mynode;
mynode=z;
n=n+1;
}
node *search()
{for(i=0;i<n;i++)
{p=p->next;
if (p->x==a)
add();
else
return NULL;
}
}
void print()
{
while (p->next!=NULL)
cout <<b<<"x^"<<a<<"+";}
void main ()
{
cout <<"please enter how many node you will manipulation"<<endl;
cin>>n;
creat();
cout<<"NODE IS CREATED"<<endl;
for (i=0;i<n;i++)
{
cout<<"a=";
cin>>a;
cout <<"b=";
cin>>b;
insert();
search();
}
print();
}