You must time the test yourself and ensure you comply with the conditions below.
line_char.c
which reads a line from its input
then reads an integer n from its input.
It should write the character in position n from the line in the format given in the examples below.
Your program should then exit - it should not read more lines.
For example:
dcc -o line_char line_char.c ./line_char abcdefghijklmnopqrstuvwxyz 0 The character in position 0 is 'a' ./line_char abcdefghijklmnopqrstuvwxyz 13 The character in position 13 is 'n' ./line_char abcdefghijklmnopqrstuvwxyz 25 The character in position 25 is 'z' ./line_char Andrew Rocks! 6 The character in position 6 is ' ' ./line_char Andrew Rocks! 7 The character in position 7 is 'R' ./line_char Andrew Rocks! 12 The character in position 12 is '!'No error checking is necessary.
You can assume a line can be read.
You can assume the line will contain at most 256 characters.
You can assume a positive integer n can be read.
You can assume the line read has at least n characters.
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest line_char
give cs1511 test10_line_char line_char.c
reverse_lines.c
which reads lines and writes them out
with the characters of each line in reverse order.
It should stop when it reaches the end of input.
For example:
dcc -o reverse_lines reverse_lines.c ./reverse_lines Two roads diverged in a yellow wood, ,doow wolley a ni degrevid sdaor owT And sorry I could not travel both htob levart ton dluoc I yrros dnA And be one traveler, long I stood doots I gnol ,relevart eno eb dnA To where it bent in the undergrowth; ;htworgrednu eht ni tneb ti erehw oT You don't make friends with salad. .dalas htiw sdneirf ekam t'nod uoYYou can assume lines will contain at most 256 characters.
You can assume lines are terminated with a newline ('\n') character,
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest reverse_lines
give cs1511 test10_reverse_lines reverse_lines.c
remove_repeated_lines.c
which reads lines and prints them
unless it has seen exactly the same line previously.
In other words it doesn't print repeated lines. It prints our only the first occurrence of any line.
It should stop when it reaches the end of input.
For example:
dcc -o remove_repeated_lines remove_repeated_lines.c ./remove_repeated_lines one one hello world hello world two two one hello world two hello hello ./remove_repeated_lines Na, na, na, na, na Na, na, na, na, na Na, na, na Na, na, na Na, na, na, na, na Na, na, na Do, do, do, do, do, Do, do, do, do, do, Do, do, do Do, do, do Do, do, do, do, do, Do, do, doYou can assume lines will contain at most 256 characters.
You assume at most 256 lines will be read before end-of-input.
You can assume lines are terminated with a newline ('\n') character,
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest remove_repeated_lines
give cs1511 test10_remove_repeated_lines remove_repeated_lines.c
You can run give multiple times. Only your last submission will be marked.
Don't submit any exercises you haven't attempted.
If you are working at home, you may find it more convenient to upload your work via give's web interface.
Remember you have until Thursday 17 May 23:59:59 to complete this test.
Automarking will be run several days after the submission deadline for the test. When complete you can view automarking here and you can view the the resulting mark via give's web interface