All pastes #718993 Raw Edit

Someone

public text v1 · immutable
#718993 ·published 2007-09-28 21:17 UTC
rendered paste body
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define MAXTEXT 1000

int main(int argc, char *argv[])
{  
  int n = strlen(argv[1]);  /*mhkos kleidiou*/
  char *p;
  int i,j,c,ti;
  char text[1000];

  if (argc==2){  /*kruptografish*/
    p=argv[1];
    i=0;
    ti=0;
    printf("Dwse to keimeno pros %s:",(argc==2)?"kruptografish":"apokruptografish");
    while ((c=getchar())!=EOF && (ti<MAXTEXT)){
      if (isalpha(c)){
	c = (tolower(c) - 'a' + 1) + ( tolower(p[i]) -'a' + 1);
	if (c>26)
	  c -= 26;
	if (++i>=n)
	  i = 0;
      }
      text[ti++] = c;
    }
    for(j=0;j<ti;j++)
      printf("%d ",text[j]);
    printf("\n");
  }
  else if ((argc==3)&&(strcmp(argv[2],"-r")) {  /*apokruptografish*/
    
  }
  else {
    fprintf(stderr,"Sfalma!Asuntaksia ths entolhs!\n");
    fprintf(stderr,"vizener <key>  i  vizener <key> -r");
  }
  return 0;
}