Odpowiedź :
Odpowiedź:
#include<iostream>
using namespace std;
string dots(string word)
{
for (int i = 0; i < word.length(); i+=1)
if (word[i] == 'u' || word[i] == 'h' || word[i] == 'o' || word[i] == 'z')
word[i] = '*';
return word;
}
int main()
{
string word = "";
cout << "Wyraz: ";
cin >> word;
cout << dots(word);
return 0;
}
------------------------------------------------------------------
#include<iostream>
using namespace std;
int nothamming(string word1, string word2)
{
int h = 0;
for (int i = 0; i < word1.length(); i++) {
if (word1[i] == word2[i]) {
h++;
}
}
return h;
}
int main()
{
string word1 = "";
string word2 = "";
cout << "Wyraz 1: ";
cin >> word1;
cout << "Wyraz 2: ";
cin >> word2;
cout << nothamming(word1, word2);
return 0;
}
Wyjaśnienie: