-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwork43.cpp
More file actions
52 lines (49 loc) · 1014 Bytes
/
Copy pathwork43.cpp
File metadata and controls
52 lines (49 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<iostream>
using namespace std;
template <class T>
int Search(const T * array, int arrayLen, const T & value)
{
for (int i = 0; i < arrayLen; i++)
{
if (array[i]==value)
{
return i;
}
}
return -1;
}
int main()
{
int n;
std::cin >> n;
int *nValues = new int[n];
for (int i = 0; i < n; i++)
{
std::cin >> nValues[i];
}
int d;
std::cin >> d;
std::cout << Search(nValues, n, d) << std::endl;
delete[] nValues;
double f;
std::cin >> n;
double *dValues = new double[n];
for (int i = 0; i < n; i++)
{
std::cin >> dValues[i];
}
std::cin >> f;
std::cout << Search(dValues, n, f) << std::endl;
delete[] dValues;
std::cin >> n;
char *cValues = new char[n];
for (int i = 0; i < n; i++)
{
std::cin >> cValues[i];
}
char c;
std::cin >> c;
std::cout << Search(cValues, n, c) << std::endl;
delete[] cValues;
return 0;
}