#include #include #include #define N 2 int main(){ int n; struct question{ int stt; char *cauhoi; }; struct answer{ int stt; char *traloi; }; struct feedback{ char * mssv; answer cautl[N]; char *ykien; }; // nhap cau hoi: question dsch[5]; //dsch: danh sach cau hoi char tam[200]; for (int i=0; i<5; i++){ printf("nhap cau hoi thu %d: ", i+1); dsch[i].stt=i+1; fflush(stdin); gets(tam); dsch[i].cauhoi = strdup(tam); printf("\n"); } fflush(stdin); int x, i=0; printf("nhap so sinh vien vao:\n"); scanf("%d", &x); // NHAN CAU TRA LOI VA Y KIEN CUA SV feedback **phanhoi; phanhoi = (feedback**)malloc(sizeof(feedback*) *x); // tao vung nho cua "phanhoi" while(imssv = strdup(maso); printf("\n hay tra loi cac cau hoi sau:\n"); // nhan cau tl int j=0; while(j<5){ printf("cau hoi thu %d: %s", j+1, dsch[j].cauhoi); char t[200]; // t la bien tam printf("\n cau tra loi cua ban la: "); fflush(stdin); gets(t); phanhoi[i]->cautl[j].traloi= strdup(t); printf("\n"); j++; } //nhap y kien char temp[200]; printf("hay nhap nhan xet cua ban la: \n"); fflush(stdin); gets(temp); phanhoi[i]->ykien= strdup(temp); i++; } for(int i = 0;imssv); for(int j = 0;j<5;j++){ printf("\nCau hoi: %s",dsch[j].cauhoi); printf("\ncau tra loi: %s",phanhoi[i]->cautl[j].traloi); } printf("\nY kien: %s",phanhoi[i]->ykien); } // giai phong vung nho for(int i=0; icautl); } for(int i=0; iykien); free(phanhoi[i]->mssv); } return 0; }