logoISU  

CS256 - Principles of Structured Design

Fall 2021

Displaying ./code/sternflCode/p3d.c

#include<stdio.h>


int main()  {
  int c;
  FILE *f = fopen("cipher", "r");
  while ( (c=fgetc(f)) != EOF) {
     if (c>='A' && c<='Z') {
       c = c-5;
       if (c<'A') {//gone off the end
          //c = (c - 'Z' -1) + 'A' ;
          c = (c - 'A' +1) + 'Z' ;
       }
     }
     putchar(c);
  }
}