Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #define n s.size()
- using namespace std;
- string traducir (string s)
- {
- string traducida;
- for(int i=0; i<n; i++)
- {
- char let = toupper( s[i] );
- if ( 65<=let && let<=90 )
- traducida+=let;
- }
- return traducida;
- }
- bool palin (string s)
- {
- bool es_pali = true;
- bool no_es_pali = false;
- if (!n)
- return no_es_pali;
- for(int i=0; i<n/2; i++)
- if ( s[i] != s[n-i-1])
- return no_es_pali;
- return es_pali;
- }
- int main()
- {
- string s;
- getline(cin,s);
- int primer = true;
- ofstream out("salida.out");
- while (s!="DONE")
- {
- if (!primer)
- cout<<endl;
- primer = false;
- s = traducir(s);
- if ( palin(s) )
- cout<<"You won’t be eaten!";
- else cout<<"Uh oh..";
- getline(cin,s);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment