mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-10-28 11:10:38 +01:00
bla bla
This commit is contained in:
17
uczelnia/2_semestr/programowanie/laby/lab12/zad6.cpp
Normal file
17
uczelnia/2_semestr/programowanie/laby/lab12/zad6.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
|
||||
template <typename T> int policz(const T *tab, int n, T wartosc) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (*(tab + i) == wartosc)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int dane[] = {1, 2, 3, 2, 2, 5};
|
||||
if (policz(dane, 6, 2) == 3) {
|
||||
std::cout << "Zgadza się :D\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user