blob: d8d61b0e248db1486db4243c85af2ef3a932434f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <iostream>
#include <cctype>
using namespace std;
template<int N>
bool* func(string (&A)[N]) {
bool* a2 = new bool[N];
for(int i = 0; i < N; ++i) {
bool is_pal = true;
for(int j = 0, z = A[i].length()-1; j < z; ++j, --z ) {
if(tolower(A[i].at(j)) != tolower(A[i].at(z))) {
is_pal = false;
break;
}
}
a2[i] = is_pal;
}
return a2;
}
int main() {
string t[] = {"oslo", "yam_a_may", "AnNa"};
auto a = func(t);
for(int i = 0; i < 3; ++i) {
cout << a[i] << ' ';
}
return 0;
}
|