Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <fstream>
- using namespace std;
- main()
- {
- ifstream wczyt;
- ofstream zap;
- int i=0, tab1[10],tab2[10], licz=0, x=0, temp=0;
- string nr1, nr2;
- wczyt.open("dane_anagramy.txt");
- if(wczyt.is_open())
- {
- while(wczyt)
- {
- wczyt >> nr1;
- wczyt >> nr2;
- for(int i = 0; i<10; i++)
- {
- tab1[i]=0;
- for(int j=0; j<8 ; j++)
- {
- if(int(nr1[j])-48 == i)
- tab1[i]++;
- }
- }
- for(int i = 0; i<10; i++)
- {
- tab2[i]=0;
- for(int j=0; j<8 ; j++)
- {
- if(int(nr2[j])-48 == i)
- tab2[i]++;
- }
- }
- temp=0;
- for(int i=0; i<10; i++)
- {
- if(tab1[i]!=tab2[i])
- {
- temp=0;
- break;
- }
- else
- temp++;
- }
- if (temp>=1)
- licz++;
- //x++;
- // if(x==1)
- // break;
- }
- cout <<"Ilosc liczb: "<< licz;
- }
- wczyt.close();
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement