uibk_703807-Advanced-CXX/exercises/task05/strange.cpp

24 lines
378 B
C++
Raw Permalink Normal View History

2020-10-22 12:46:23 +02:00
#include <iostream>
int array[5] = {};
bool contains(int v)
{
for (int i = 0; i <= 5; ++i) {
if (array[i] == v) {
return true;
}
}
return false;
}
int main()
{
for (int i = 0; i < 10; ++i) {
auto contains_text = contains(i) ? "contains " : "does not contain ";
std::cout << "array " << contains_text << i << std::endl;
}
std::cout << "done" << std::endl;
}