fork download
  1. #include <stdio.h>
  2. #include <cs50.h>
  3. #include <math.h>
  4. #include <stdlib.h>
  5. #include <ctype.h>
  6. #include <string.h>
  7.  
  8. int main(int argc,string argv[]){
  9.  
  10. if (argc != 2) {
  11. return 1;
  12. }
  13.  
  14. int k = atoi(argv[1]) % 26;
  15. string msg = GetString();
  16. int msglen = strlen(msg);
  17.  
  18.  
  19. for (int i = 0; i < msglen; i++) {
  20.  
  21. if (isupper(msg[i]) && msg[i] + k > 90 ) {
  22. printf("%c", (msg[i] + k) % 90 + 65);
  23. }
  24. else if (islower(msg[i]) && msg[i] + k > 90) {
  25. printf("%c", (msg[i] + k) % 172 + 97);
  26. }
  27. else if (!isalpha(msg[i])){
  28. printf("%c", msg[i]);
  29. }
  30. else {
  31. printf("%c", (char) msg[i] + k);
  32. }
  33. }
  34. printf("\n");
  35. return 0;
  36.  
  37.  
  38. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:2:18: fatal error: cs50.h: No such file or directory
 #include <cs50.h>
                  ^
compilation terminated.
stdout
Standard output is empty