Logo  

CS256 - Fundamentals of Structured Programming

Displaying exercises/e9/files/f2.c

#include <stdio.h>

/**
 * Make a program that takes a filename from the command line, or print the
 * usage message: "Usage: f2 <filename>\n" if it's absent.
 * Open the file for reading and read it one character at a time.  Use the
 * lrot (for lowercase letters) and urot (for uppercase characters) strings
 * to translate characters that you read and then output the translated
 * characters.  If the character read is not a letter, then output it as-is.
 * To translate a character, subtract either the lowercase 'a' (for lowercase
 * letters) or 'A' (for uppercase letters) to get it's index location in the
 * *rot string, i.e.: output lrot[ch-'a'] if the character in ch is lowercase.
 */
int main(int argc, char *argv[])
{
  char lrot[] = "nopqrstuvwxyzabcdefghijklm";
  char urot[] = "NOPQRSTUVWXYZABCDEFGHIJKLM";

  
  return 0;
}