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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -