#include <iostream>
using namespace std;
template <typename T>
bool func (T * arr, int size)
{
for (int i = 0 ; i < size - 1; ++i)
if ( (arr[i] >= 0 && arr[i+1] >= 0) || ((arr[i] <= 0 && arr[i+1] <= 0)))
return false;
}
return true;
int main()
int numbers[] = {2, -1};
cout << func(numbers, sizeof(numbers) / sizeof(int));
return 0;
// Как-то так ;P
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
template <typename T>
bool func (T * arr, int size)
{
for (int i = 0 ; i < size - 1; ++i)
{
if ( (arr[i] >= 0 && arr[i+1] >= 0) || ((arr[i] <= 0 && arr[i+1] <= 0)))
return false;
}
return true;
}
int main()
{
int numbers[] = {2, -1};
cout << func(numbers, sizeof(numbers) / sizeof(int));
return 0;
}
// Как-то так ;P