From c0cc72f03f700ee705e139fb4bf95a7ce03d0b81 Mon Sep 17 00:00:00 2001 From: Oskar Date: Mon, 7 Oct 2024 19:46:27 +0200 Subject: more --- 9p5.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 9p5.cpp (limited to '9p5.cpp') diff --git a/9p5.cpp b/9p5.cpp new file mode 100644 index 0000000..542da8c --- /dev/null +++ b/9p5.cpp @@ -0,0 +1,36 @@ +#include +#include + +/* + * + * 9.5 + * + * + */ + +std::vector::const_iterator FindValue(std::vector::const_iterator CBegin, + std::vector::const_iterator CEnd, + int Value) { + + for( ; CBegin != CEnd ; ++CBegin) { + if(*CBegin == Value) { + return CBegin; + } + } + + return CEnd; +} + +int main () { + + int Value; + if(std::cin >> Value) {} else { return -1; } + + std::vector a = {1,4,2,545,42,6,334,24,5,224,7,6,9,32,3,63,436}; + if(FindValue(a.cbegin(), a.cend(), Value) == a.cend()) { + return 0; + } + + std::cout << "Value found!\n" << std::ends; + return 0; +} -- cgit v1.2.3