Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int rozmiar(char** napisy, int rozmiar)
- {
- int wynik = rozmiar;
- for(int i=0; i<rozmiar; i++)
- {
- for(int j=0; j<rozmiar; j++)
- {
- if(strlen(napisy[i])==strlen(napisy[j]))
- {
- bool takiesame = true;
- for(int k=0; k<strlen(napisy[i]); k++)
- {
- if(napisy[i][k]!=napisy[j][k]) takiesame = false;
- }
- if(takiesame == true)
- {
- delete[] napisy[i];
- wynik--;
- }
- }
- }
- }
- return wynik;
- }
- int main()
- {
- char** napisy = new char*[5];
- for(int i=0; i<5; i++)
- {
- napisy[i]=new char[255];
- cin >> napisy[i];
- }
- cout << rozmiar(napisy, 10) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement