Please help, what is the errors here?

I want to know please the errors in my code:

#include <stdio.h> #include <stdlib.h>

typedef struct node*s;
struct node
{
int power;
s next;
double Cofficent;
};
typedef s list; typedef s postion;
int Empety(list); int last(list,postion);
void print(list); postion perivous(list,int);
postion find(list,int); void insert(list,postion,double,int);
void delete(list,int); void add(list,list,list);
void subtract(list,list,list);
void multply(list,list,list);
void modify(list,list,list);
void appended(list,double,int);

int main()
{

list equation1; list equation2; list sum; list subtr; list multy; sum=NULL; subtr=NULL; multy=NULL;

printf("\t\tplease enter the all of cases :\n"); printf("\t\t \n"); printf("\t\t\n"); printf("please enter the two equation of the polynomial\n"); printf("ADE the two equation\n"); printf("Subtract the two equation\n"); printf("Multiply the two equation\n"); printf("Delete the two equation\n "); printf("print the two equation\n"); printf("Modeify the equation\n"); printf("the Exist \n"); int choise; scanf(" the cases is %d",&choise);

{

while(case!=8)

switch(case); { case1:printf("please enter the equation1\n");

char equation1[30]; scanf("%s",&equation1); printf("please enter the equation 2\n"); char equation2[30]; scanf("%s",&equation2); break; case2:printf("ADE the two equation \n "); add(equation1,equation2,sum); break; case3:printf("subtract the two equation \n"); subtract(equation1,equationt2,subtr); break;

case4:printf("Multuply the two equation\n");

break;

case5:printf("Delete the equation\n"); delete(equation1,equation2); break;

case6:printf("print the equation\n");

{

if(equation1==NULL&&equation2==NULL)

printf("no information to print it\n"); } else printf("the case1 :the equation1"); print(equation1); printf("the case2:the equation2"); print(equation2); printf(:the sum of the equation\n); add(equation1,equation2,sum); printf("the subtrcation of the equation\n"); subtract(equation1,equation2,substr); if(multy!=NULL) printf("multiplication of the equation"); multply(equation1,equation2,multy);

break;

case7:printf("Modefiy the equation\n"); break;

case8:printf("Exist \n"); break;

default:printf("the result is wrong\n"); }

printf("please enter any case from it\n "); char k; scanf("%d",&k); printf("\n"); printf("\n"); printf("\n"); printf("\n") printf("please enter the two equation of the polynomial\n"); printf("\t\t \n"); printf("\t\t\n"); printf("please enter the two equation of the polynomial\n"); printf("ADE the two equation\n"); printf("Subtract the two equation\n"); printf("Multiply the two equation\n"); printf("Delete the two equation\n "); printf("print the two equation\n"); printf("Modeify the equation\n"); printf("the Exist \n"); int case; scanf("%d",&case); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n");

}

exsit(0);

return 0; } void insert(list l,postion p,double c,int p) { if(l==NULL) l=(list)molloc(sizeof(struct node)); postion temp; temp=(postion)molloc(sizeof(struct node));

if(temp!=NULL){

l->next=temp; temp->next=NULL;

temp->Cofficent=c; temp->power=p;

} else

if(temp!=NULL)

{

temp->next=p->postion; p->postion=temp;

temp->cofficent =c; temp->power=p;

}

postion perivous(list l,int m);

{ postion p; p=l; if(p->next!=Null&&p_>power!=m)

p=p->next;

}

return p;

int Empety(list l)

{ return (l->next==NULL); }

int last(list l,postion p) { return (p->next==NULL);

} void delete(list l,int m) { postion p; postion temp; p=perivous(l,m); if(!last(p,m)); { temp=p->next; p->next=temp->next; free(temp);

} void appended(list l,double cofficent,int power) {

if(l==NULL) } l=(list)molloc(sizeof(struct node)); postion temp; temp=(postion)molloc(sizeof(struct node)); l->next=temp; temp->cofficent=cofficent; temp->power=power; { else } postion p; p=l->next; while(p->next!=NULL) p=p->next; postion temp; temp=(postion)molloc(sizeof(struct node)); p->next=temp; temp->coffican=cofficent; temp->power=power;

} void add(list equation1,list equation2,list sum) {

if(equation1!=NULL&&equation2!=NULL)

postion s1=equation1->next; postion s2=equation2->next; while(s1!=NULL||s2==NULL) { if(s1->power>s2->power) appended(s1->cofficent,s2->power,sum); s1=s1->next;

else if(s2->power>s1->power) {

appended(s2->cofficent,s2->power,sum); s2=s2->next; else

if(s2->power==s1->power)

appended(s2->cofficent+s1->coofficent,s2->power); s1=s1->next; s2=s2->next;

}

print(sum);

}

prinf("no information and you can enter the equation that you choisn");

} void print(list l)

{ if(l!=NUll)

postion p; p=l->next; if(p!=NULL) printf("%fx^%d",p->cofficent,p->power); p=p->next; if(p!=NULL) printf("+");

} void subtract(list equation1,list equation2,list subrt)

{ if(equation1!=NULL&&equation2!=NULL) {

postion s; s=equation2->next; if(s!=NULL) s->cofficent=((0)-s->coffifent); add(equation1,equation2,subtr); } else

printf("no information and please enter the case (1) of equation\n");

} void delete list(list l)

{

if(l!=NULL) postion p; p=l->next; while(p!=NULL)

{ postion temp; temp=p; p=temp->next; l->next=p;

} void delete(equation1,equation2) { if(equation1==NULL&&equation2==NULL) {

printf("no information to delete it\n"); } else

{ int case; printf("the equation that you want to delte it"); printf("case1"); printf("equation1"); printf("\n"); printf("case2"); printf("equation2"); printf("\n"); scanf("%d",&case); while(case!=1&&case!=2) {

printf("the wrong in formation\n"); printf("please enter any equation that you want to delete"); printf("case1"); printf("equation1"); printf("\n"); printf("case2"); printf("equation2");

}

if(case==1) {

delete list(equation1); printf("enter the anthor equation")' char[30]; scanf("%s",equation); input_equation(equation,equation1);

}

if(case==2) {

delete list(equation2); printf("enter the anthor equation")' char[30]; scanf("%s",equation); input_equation(equation,equation2);

}

}

}

}

}

-------------------------------------------
with correcting it please :)
Last edited on
a) please use code tags
b) we arent going to run the code for you to see what happens. that is your job
c) if it does have errors that you dont know how to fix we will help you with those
Topic archived. No new replies allowed.