fork download
  1. #include <stdio.h>
  2.  
  3. void fixMistake(char s[]) {
  4. int i;
  5. for (i = 0; s[i] != '\0'; i++) {
  6. if (s[i] == '1') {
  7. s[i] = 'I';
  8. }
  9. }
  10. }
  11.  
  12. int main(void) {
  13.  
  14. char str1[] = "1NFORMAT1ON";
  15. char str2[] = "1iI";
  16.  
  17. printf("変換前: %s\n", str1);
  18. fixMistake(str1);
  19. printf("変換後: %s\n\n", str1);
  20.  
  21. printf("変換前: %s\n", str2);
  22. fixMistake(str2);
  23. printf("変換後: %s\n", str2);
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
変換前: 1NFORMAT1ON
変換後: INFORMATION

変換前: 1iI
変換後: IiI