CS1411 - Programming Principles I, Summer I 2005

Programming project 2

Problem Statement

Write a program that reads a file line by line and reverts every line. The results should be written back in another file

Program flow

  • Read in filename1 from the user
  • Read in filename2 from the user
  • Read file 1 line-by-line. Revert every line and write it into file2

Samples to try:

The ESL cookbook has some words you can try.

Additional requirements

  • Do the string-reverting in an extra function. This function should work on the string without directly outputting it. The header could look like any of these: void revert(string &s); string revert(string s); void revert(char s[]);
  • Move the string reverting function into an extra file. Provide a header file with the prototype and use that from your main program.
  • Put your string reverting function into a namespace.
  • Include a UML activity diagram (flowchart) for the string revert function, similar to the ones given in the book. You do not have to add UML comments, just the flow of control.
  • Please make sure that flowchart and program code match!
  • There should be approximately one box in your flowchart for every line of code!

How it should be written

  • Every file should include your name in a comment!
  • Please turn in a password, which I will use to post grades on the website
  • The program should be written in C++ using only standard libraries (as we had in class)
  • The program must be your unique work. There should be no code sharing between students!

Notes on grading

You may use things that we have not had in class, you may add additional functionality, however: I can not grade you on creativity, just on the requirements. If you add extra functionality that does not work, it may bring your grade down.

Please make sure your program compiles. If it does not compile, this will cut down your grade a lot. It is better to pass in a version with less functionality than a not compiling one.

Submission

Mail your code (only your program, and only the .cpp file) to me and also bring a printout and the extra documentation to class on June 27 2005. If you cannot come to class either hand in the assignment early or make some arrangements with me. I will not accept just emailed programs or programs in my mailbox unless I have told you that it is ok to do so!

If the instructions are unclear or you have any other questions, please email me