Advertisement
Serebro2064

Untitled

May 31st, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | Fixit | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. string replace(string argv[1]);
  6.  
  7. int main(int argc, string argv[])
  8. {
  9. if (argc == 1 || argc > 2 )
  10. printf ("ERROR: Please input a single command line argument\n");
  11. return 1;
  12.  
  13. if (argc == 2)
  14. {
  15. string modified = replace(argv);
  16. printf("%s\n", modified);
  17. }
  18. }
  19.  
  20. string replace(string argv[1])
  21. {
  22. int length;
  23. length = strlen(argv[1]);
  24.  
  25. for (int i = 0; i < length; i++)
  26. {
  27. switch (argv[1][i])
  28. {
  29. case 'a': argv[1][i] = 6;
  30. case 'e': argv[1][i] = 3;
  31. case 'i': argv[1][i] = 1;
  32. case 'o': argv[1][i] = 0;
  33. }
  34. }
  35. return argv[1];
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement