Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- #include <string>
- #include <conio.h>
- using namespace std;
- string imie, nazwisko;
- int nr_tel;
- int main()
- {
- fstream d,w;
- d.open("dane.txt",ios::in);
- w.open("wyniki.txt",ios::out);
- if(d.good()==false)
- {
- cout<<"popsules cos moze utworz d zal mi cie"<<endl;
- exit(0);
- }
- string l;
- int dl=0;
- int k=0;
- while(getline(d,l)) {
- dl=l.length();
- k=0;
- for (int i=0;i<dl/2;i++) if(l[i]!=l[dl-i-1]) k++;
- if(k!=0) w<<l<<" nie jest palindromem"<<endl;
- else w<<l<<" jest palindromem"<<endl;
- }
- d.close();
- w.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement