How to find minimum value from vector?
c++
Solution
You have an error in your code. This line:
for (int i = 0;i < v[n]; i++)
should be
for (int i = 0;i < n; i++)
because you want to search `n` places in your vector, not `v[n]` places (which wouldn't mean anything)
Problem
How can I find the minimum value from a vector? ``` int main() { int v[100] = { 5, 14, 2, 4, 6 }; int n = 5; int mic = v[0]; enter code here for (int i=0; i < v[n]; i++) { if (v[i] < mic) mic = v[i]; } cout< < mic; } ``` But is not working, what can I do?