I am starting to learn the C programming language and using Microsoft Visual C ++ to write and test code.
Below the program in text C (section 1.5.1), copy your input to your output via putchar () and getchar ():
#include <stdio.h> int main(void) { int c; while ((c = getchar()) != EOF) putchar(c); return 0;}
The program prints the characters entered by the keyboard each time you press ENTER. As a result, I can enter only one line before printing. I cannot find a way to enter multi-line text from the keyboard before typing.
Is there a way and how to allow this program to input and output multi-line text from the keyboard?
Sorry if this is a basic and uninformed question.
Appreciate your attention and thanks.
source share