, , . ++, ( ), . ++ 11: std::begin std::end auto :
#include <algorithm>
#include <utility>
#include <iterator>
template<class Array, class T>
bool find_in( Array const& arr, T const& t ) {
using std::begin; using std::end;
const auto b = begin(arr);
const auto e = end(arr);
const auto it = std::find( b, e, t );
return !(e != it);
}
find_in , true, .
. using namespace std;, - std:: .
#include <iostream>
int main() {
int A = 0
std::cin >> A;
int B = 0
std::cin >> B;
int C=0;
int DECKlist[3] = {151,156,720};
bool A_in_list = find_in(DECKlist, A);
bool B_in_list = find_in(DECKlist, B);
if (A_in_list != B_in_list)
C = 1;
std::cout << C << "\n";
}
, , "" .
, - , , !=.
source
share