Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- FILE* f, *g;
- char a, b;
- int numar, i, count = 1;
- if (fopen_s(&f, "in.txt", "rt") != 0) {
- printf("Fiser negasit");
- return 0;
- }
- if (fopen_s(&g, "out.txt", "wt") != 0) {
- printf("Fiser negasit");
- return 0;
- }
- fscanf_s(f, "%c", &a);
- while (fscanf_s(f, "%c", &b) != EOF) {
- if (a == b) {
- count++;
- }
- else {
- fprintf_s(g, "%c%d", a, count);
- count = 1;
- a = b;
- }
- }
- fclose(f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement