Em chạy đến hàm hiển thị thì chương trình dừng. mn ktra giúp em vì sao ạ?
#include<iostream>
using namespace std;
struct dt{
int hs,sm;
};
struct node {
dt data;
struct node *next;
};
typedef struct node *dathuc;
void init(dathuc &f){
f=NULL;
}
node *getnode(dt x){
node *p=new node;
p->data=x;
p->next=NULL;
return p;
}
void themcuoi(dathuc &f, dt &x){
node *p,*q;
p=getnode(x);
if(f==NULL){
f=p;
}
else {
q=f;
while(q->next!=NULL){
q=q->next;
}
q->next=p;
p->next=NULL;
}
}
void nhapdonthuc(dt &x){
cout<<"\n Nhap so mu: "; cin>>x.sm;
cout<<"\n Nhap he so: "; cin>>x.hs;
}
void nhap(dathuc f){
dt x;
int n;
cout<<"\n Nhap so luong don thuc: "; cin>>n;
for(int i=0;i<n;i++){
cout<<"\n Nhap don thuc: "; nhapdonthuc(x);
themcuoi(f,x);
}
}
void hienthi(dathuc f){
node *q=f;
dt x;
cout<<"\nF(x)= ";
while(q->next!=NULL){
cout<<q->data.hs<<"*x^"<<q->data.sm<<" + ";
q=q->next;
}
cout<<q->data.hs<<"*x^"<<q->data.sm;
}
void menu(){
dt x;
int chon;
dathuc f,P,Q;
init(f); init(P); init(Q);
while(1){
cout<<"\n\t\tMENU";
cout<<"\n1.Nhap P(x).\n2,Nhap Q(x)\n";
cout<<"Moi chon thao tac."; cin>>chon;
switch(chon){
case 1: {
nhap(P); hienthi(P);
break;
}
case 2: {
nhap(Q); hienthi(Q);
break;
}
default : cout<<" Moi chon lai.";
}
}
}
int main(){
menu();
}
, thêm dấu và trước f là được: 
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?