Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <stdlib.h>
- #include <math.h>
- #include <sstream>
- using namespace std;
- int main()
- {
- fstream otworz;
- otworz.open("sygnaly.txt", ios::in);
- string linia;
- int licznikSame = 0;
- int licznikRozne = 0;
- string slowo;
- int maxx = 0;
- bool czyMniejszerowne10 = true;
- while(!otworz.eof())
- {
- otworz >> linia;
- for(char i = 0; i < linia.length(); i++)
- {
- for(int j = 0; j < linia.length(); j++)
- {
- if((abs((int)linia[i]-(int)linia[j])) > 10)
- {
- czyMniejszerowne10 = false;
- }
- }
- }
- if(czyMniejszerowne10 == true) cout << linia << endl;
- czyMniejszerowne10 = true;
- }
- return 0;
- }
- /*int main()
- {
- fstream otworz;
- otworz.open("sygnaly.txt", ios::in);
- string linia;
- int licznikSame = 0;
- int licznikRozne = 0;
- string slowo;
- int maxx = 0;
- while(!otworz.eof())
- {
- otworz >> linia;
- for(char i = 'A'; i <= 'Z'; i++)
- {
- for(int j = 0; j < linia.length(); j++)
- {
- if(linia[j] == i) licznikSame+=1;
- }
- if(licznikSame > 0) licznikRozne+=1;
- licznikSame = 0;
- }
- if(licznikRozne > maxx)
- {
- slowo = linia;
- maxx = licznikRozne;
- }
- //cout << linia << " ";
- //cout << licznikRozne << endl;
- licznikRozne = 0;
- }
- cout << slowo << " ";
- cout << maxx << endl;
- return 0;
- }*/
- /*int main()
- {
- fstream otworz;
- otworz.open("sygnaly.txt", ios::in);
- string linia;
- int licznik = 1;
- string slowo = "";
- while(!otworz.eof())
- {
- otworz >> linia;
- if(licznik%40 == 0) slowo+=linia[9];
- licznik++;
- }
- cout << slowo;
- return 0;
- }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement