Kod był wyświetlany 2485 razy.
/*
Name: Anagram
Copyright: GPL GNU
Date: 10-03-13 11:26
Description:
*/
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
string slowo1, slowo2;
cout<<"\n\n\tPodaj slowo pierwsze: ";
cin>>slowo1;
cout<<"\n\n\tPodaj słowo drugie: ";
cin>>slowo2;
sort(slowo1.begin(),slowo1.end()); //sortowanie liter w slowie
sort(slowo2.begin(),slowo2.end());
if (slowo1==slowo2)
cout<<"\n\n\tanagramy\n";
else cout<<"\n\n\tnie sa anagramami\n";
return 0;
}
Pobierz plik tekstowy