#include #include #include #include struct chain { char data; struct chain *next; }; typedef struct chain chain; int wait(int maxloop) { int i; for(i=0;inext=NULL; flag=1; break; case 27:exit(EXIT_FAILURE); case 8: if(first==NULL) { sound(ers); delay(50); nosound(); } else { if(old==first) { free(first); first=NULL; } else { for(temp=first;temp->next!=NULL;temp=temp->next); for(old=first;old->next!=temp;old=old->next); old->next=NULL; free(temp); } } break; default:if(first==NULL) { first=(chain *)malloc(sizeof(chain)); first->data=ch; first->next=NULL; old=first; } else { newlink=(chain *)malloc(sizeof(chain)); newlink->data=ch; newlink->next=NULL; old->next=newlink; old=newlink; } if(x>maxx||ch==13) { x=1; y++; } if(y>maxy) { textbuff=(char *)malloc(maxx*(maxy-1)); gettext(1,2,maxx,maxy,textbuff); puttext(1,1,maxx,maxy-1,textbuff); free(textbuff); x=1; y=maxy; insline(); } gotoxy(x,y); cprintf("%c",ch); x++; sndgen(nrs); } if(flag==1) break; } clrscr(); for(old=first;old!=NULL;old=old->next) { if(kbhit()) break; printf("%c",old->data); } }