Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /*
- A12. Napisać funkcję
- bool f(char* s)
- która zwraca true wtedy i tylko wtedy, gdy każde dwa kolejne znaki w napisie s są
- różne.
- */
- bool f(char* s)
- {
- for(int i = 0; i < 100; ++i)
- if(s[i] && s[i] == s[i+1])
- return false;
- return true;
- }
- int main()
- {
- char napis[100] = "jakis napis";
- cout << f(napis);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment