MeehoweCK

Untitled

Nov 27th, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. /*
  6. A12. Napisać funkcję
  7. bool f(char* s)
  8. która zwraca true wtedy i tylko wtedy, gdy każde dwa kolejne znaki w napisie s są
  9. różne.
  10. */
  11.  
  12. bool f(char* s)
  13. {
  14.     for(int i = 0; i < 100; ++i)
  15.         if(s[i] && s[i] == s[i+1])
  16.             return false;
  17.     return true;
  18. }
  19.  
  20. int main()
  21. {
  22.     char napis[100] = "jakis napis";
  23.     cout << f(napis);
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment