fork download
  1. int main(int argc, char *argv[])
  2. {
  3. setlocale(LC_ALL, "Russian");
  4. char str[550] = " ";
  5. char res[500] = " ";
  6. char out[500] = " ";
  7. int j = 0, i = 0;
  8. int k = 0;
  9. char str2[1000] = " ";
  10. /*FILE *fp, *f_out;*/
  11. int c;
  12. FILE *fp = fopen("in.txt", "r"), *f_out = fopen("out.txt", "w");
  13. int l = 0;
  14.  
  15. fgets(str, 550, fp);
  16.  
  17. for (k = 0; k < strlen(str); k++)
  18. {
  19. if (str[k] == ' ') //probel
  20. {
  21. if (j == 0) continue;
  22. if (str[k + 1] == ' ')
  23. continue;
  24. }
  25. res[j] = str[k];
  26. j++;
  27.  
  28. //абзаци
  29. if (*(str + i) == '\t' && *(str + i + 1) == '\t')
  30. {
  31. int q = i;
  32. while (q < strlen(str))
  33. {
  34. *(str + q) = *(str + q + 1);
  35. q++;
  36. }
  37. }
  38. //одинаковые символы
  39. if (*(str + i) == *(str + i + 1))
  40. {
  41. int q = i;
  42. while (q < strlen(str))
  43. {
  44. *(str + q) = *(str + q + 1);
  45. q++;
  46. }
  47. }
  48. else
  49. {
  50. *(res + i) = *(str + i);
  51. i++;
  52. }
  53. }
  54.  
  55. printf("%s", res);
  56. fprintf(f_out, "%s", res);
  57. fclose(fp);
  58. fclose(f_out);
  59.  
  60. system("pause");
  61. /**************************************/
  62. return 0;
  63. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main(int, char**)':
prog.cpp:3:12: error: 'LC_ALL' was not declared in this scope
  setlocale(LC_ALL, "Russian");
            ^
prog.cpp:3:29: error: 'setlocale' was not declared in this scope
  setlocale(LC_ALL, "Russian");
                             ^
prog.cpp:12:2: error: 'FILE' was not declared in this scope
  FILE *fp = fopen("in.txt", "r"), *f_out = fopen("out.txt", "w");
  ^
prog.cpp:12:8: error: 'fp' was not declared in this scope
  FILE *fp = fopen("in.txt", "r"), *f_out = fopen("out.txt", "w");
        ^
prog.cpp:12:32: error: 'fopen' was not declared in this scope
  FILE *fp = fopen("in.txt", "r"), *f_out = fopen("out.txt", "w");
                                ^
prog.cpp:12:36: error: 'f_out' was not declared in this scope
  FILE *fp = fopen("in.txt", "r"), *f_out = fopen("out.txt", "w");
                                    ^
prog.cpp:15:20: error: 'fgets' was not declared in this scope
  fgets(str, 550, fp);
                    ^
prog.cpp:17:29: error: 'strlen' was not declared in this scope
   for (k = 0; k < strlen(str); k++)
                             ^
prog.cpp:55:18: error: 'printf' was not declared in this scope
  printf("%s", res);
                  ^
prog.cpp:56:26: error: 'fprintf' was not declared in this scope
  fprintf(f_out, "%s", res);
                          ^
prog.cpp:57:11: error: 'fclose' was not declared in this scope
  fclose(fp);
           ^
prog.cpp:60:16: error: 'system' was not declared in this scope
  system("pause");
                ^
stdout
Standard output is empty