#include #include #include #ifdef WIN32 # include # define clrscr() system("cls") # define pause() getch() #else # define clrscr() printf("\033c") # define pause() getchar() #endif char *getline(); char *toBinary(char *); char *reverse(char *); int main(int argc, char *argv[]) { char *b; char *d; char *q; while(1) { clrscr(); printf("%s\n", "pregetline"); b=getline(); printf("%s: %s\n", "prereverse", b); d=reverse(b); printf("%s\n", d); q=toBinary(d); printf("%s\n", q); pause(); } return EXIT_SUCCESS; } char *getline() { char *buf = NULL, tmp=0; int i=0; while((tmp = getc(stdin)) != '\n' && tmp != EOF) { buf = (char *)realloc(buf, i+1); buf[i]=tmp; i++; } buf[i]=0; return buf; } char *toBinary(char *str) { char *buf = ""; char *q; int co; int o; char wee; for(int i=0;i