fork download
  1. #include <stdio.h>
  2. #include <cs50.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6. int main(int argc, string argv[])
  7. {
  8.  
  9.  
  10.  
  11. if (argc != 2)
  12. {
  13. printf("wrong!");
  14. return 1;
  15. }
  16. else
  17. {
  18. int k = atoi(argv[1]) % 26;
  19. string p = GetString();
  20.  
  21. for (int i = 0, s = strlen(p); i < s; i++)
  22. {
  23. if(isalpha(p[i]))
  24. {
  25. if (isupper(p[i]))
  26. {
  27. int n = k + p[i];
  28. if (n > 90 || n < 65)
  29. {
  30. printf("%c", p[i] - 26 + k);
  31. }
  32. else
  33. {
  34. printf("%c", n);
  35. }
  36. }
  37. else if (islower(p[i]))
  38. {
  39. int n = k + p[i];
  40. if (n > 122 || n < 97)
  41. {
  42. printf("%c", p[i] - 26 + k);
  43. }
  44. else
  45. {
  46. printf("%c", n);
  47. }
  48. }
  49. else
  50. {
  51. printf("%c", p[i]);
  52. }
  53.  
  54. }
  55. else
  56. {
  57. printf("%c", p[i]);
  58. }
  59.  
  60. }
  61. printf("\n");
  62.  
  63. return 0;
  64. }
  65. }
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
compilation terminated.
stdout
Standard output is empty