Poniżej kod dla punktów a, b, c.
D nie mam jak teraz zrobić, bo nie mam kompilatora lokalnie na mojej maszynie. Dopiszę jutro
#include <string>
#include <unordered_map>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
string words[3];
cout << "Podaj 3 wyrazy" << endl;
for (int i = 0; i < 3; i++)
{
cout << "Podaj wyraz " << i + 1 << "..." << endl;
cin >> words[i];
}
//sort
int n = sizeof(words) / sizeof(words[0]);
sort(words, words + n);
//szyfr
hash<string> hasher;
string word = words[0];
size_t wordHashed = hasher(words[0]);
cout << "Zaszyfrowany wyraz " << word << " => " << wordHashed << endl;
//czy są dłuższe niż 5
for (int i = 0; i < 3; i++)
{
string result = words[i].size() > 5 ? "dłuższy" : "krótszy";
cout << "wyraz " << words[i] << " jest " << result << " niż 5 znaków" << endl;
}
return 0;
}