Trouble!Trouble!

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by Zakrevskijj, 24 Apr 2013.

  1. Zakrevskijj

    Zakrevskijj New Member

    Joined:
    19 Apr 2013
    Messages:
    1
    Likes Received:
    0
    Reputations:
    0
    Не могу понять,что не так с кодом.Подскажите,пожалуйста.Буду очень признателен.
    Code:
     
    #include <stdio.h> 
    #include <string.h>
     #define SHIFT 2
     char translate (char l) 
    { char res = l ;
     if (' a '<= l && l <= 'z') 
    res ='a'+(26+(l -'a')+SHIFT)%26; 
    if ('A'<= l && l <= 'Z') 
    res = 'A'+(26+(l-'A')+SHIFT)%26;
     return res ; }
     int main (int argc, char **argv )
     { FILE *f; if (argc<2)
    { printf ("No file provided \n"); 
    return 1; } 
    f = fopen (argv[1],"r"); 
    if ( f==NULL){
     printf (" Cannot open file: '%s'\n ", argv [1]); return 1;} int ch;
     while (( ch = getc (f))!=EOF){
     printf ("% c", translate(( char) ch)); 
    } 
    char key[]="_i5_F"; 
    printf ("Yes,this file was encrypted via simple Caesar substitution cipher The flag is: Scrypt0% sUNNN \n ", key) ;
     return 0;
     }