c - Read in a paragraph witht getchar() and print it with a loop and putchar() -
c - Read in a paragraph witht getchar() and print it with a loop and putchar() -
i have been working on while , wondering if possible read in paragraph getchar() , print putchar(). know there improve methods read in , print out paragraph, messing around c , curious, here have far:
#include <stdio.h> int main() { int c; printf( "enter value:"); { (int i=0; i<10000; i++) { c = getchar( ); putchar( c ); } printf("\nthank you"); printf("\n"); } homecoming 0; }
my desired output be:
enter in value/paragraph:
your entered value is:
i guess wanted capture whole paragraph altogether. need stop when press enter.
here detail: getchar()
wait come in anyway, , during time, ever typed, stored in buffer , shown on screen @ same time. after press enter, getchar()
stops wait, , homecoming 1 char @ time can print them putchar
.
/* getchar illustration : typewriter */ #include <stdio.h> int main () { int c; puts ("enter text. press come in exit:"); { c=getchar(); putchar (c); } while (c != '\n'); homecoming 0; }
c for-loop while-loop char
Comments
Post a Comment