Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if wersja==5
- using namespace std;
- int main()
- {
- int k = 0;
- char * wsk;
- char c[30];
- cout << "Podaj ciag szukany" << endl;
- cin.get(c, 30);
- char *a;
- a = &c[0];
- cout << c << endl;
- FILE *plik = nullptr;
- int dane;
- char znak;
- char buffer;
- if ((plik = fopen("test.txt", "r+")) != nullptr)
- {
- while (!feof(plik))
- {
- fscanf(plik, "%c ", &buffer);
- //cout << buffer;
- wsk = strchr(&buffer, *a);
- while (wsk != NULL)
- {
- wsk = strchr(wsk + 1, *a);
- k++;
- }
- }
- if (k>0)
- cout << "Liczba powtorzen w pliku: " << k;
- fclose(plik);
- }
- else
- cout << "Nie udalo sie otworzyc pliku na dysku!\n";
- cout << endl;
- return 0;
- }
- #endif//(wersja==5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement