Parrot
This is a warmup exercise.
It is not compulsory, and may be
completed individually or with your lab partner.
Write a program that uses getchar()
and putchar()
to repeat the user’s input. getchar()
reads
the next character from standard input and returns it. When getchar()
reaches the end of a file,
it will return the value EOF
(End Of File). You can enter EOF
into the terminal
by pressing Ctrl+D, which will cause getchar()
to return the EOF
value.
putchar()
takes in a single character as a parameter and prints it to standard output.
Some Examples
abc abc
ABCabc123 ABCabc123
abc abc xyz xyz
To run some simple automated tests:
$ 1511 autotest parrot
To run Styl-o-matic:
$ 1511 stylomatic parrot.c Looks good!
You’ll get advice if you need to make changes to your code.
Submit your work with the give command, like so:
$ give cs1511 wk05_parrot
Or, if you are working from home, upload the relevant file(s) to the wk05_parrot activity on Give Online.