Created
March 22, 2014 04:07
-
-
Save fxxkscript/9700937 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #define MAX_ARRAY 100 | |
| int main(int argc, char *argv[]) { | |
| int i; | |
| char s[MAX_ARRAY], c; | |
| int lim = MAX_ARRAY; | |
| setbuf(stdout, NULL); | |
| setbuf(stdin, NULL); | |
| // for (i = 0; i < lim - 1 && scanf("%c", &c) != '\n' && c != EOF; ++i) { | |
| // s[i] = c; | |
| // printf("%c", s[i]); | |
| // } | |
| // i = 0; | |
| while (i < lim - 1) { | |
| fprintf(stdout, "%c", c); | |
| fflush(stdout); | |
| scanf("%c", &c); | |
| if (c == '\n') { | |
| break; | |
| } else if (c == EOF) { | |
| break; | |
| } | |
| s[i] = c; | |
| i++; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment