Rotate One

This is a warmup exercise. It is not compulsory, and may be completed individually or with your lab partner.

Download rotateOne.c, or copy it into your current directory on a CSE system by running

$ cp /web/cs1511/17s2/week05/files/rotateOne.c .

You are to implement the rotateOne function, which “rotates” a letter through the alphabet by one position. This means that if the input is ‘a’, the output should be ‘b’. ‘z’ becomes ‘a’ and ‘Z’ becomes ‘A’.

Any non-letter characters should be returned unchanged.

Some Examples

abc
bcd
Hello, world!
Ifmmp, xpsme!
17 is my favourite number.
17 jt nz gbwpvsjuf ovncfs.

To run some simple automated tests:

$ 1511 autotest rotateOne

To run Styl-o-matic:

$ 1511 stylomatic rotateOne.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_rotateOne

Or, if you are working from home, upload the relevant file(s) to the wk05_rotateOne activity on Give Online.