I am stuck on an easy question and I don’t know what the error is in my code.
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,max=-1000000000;
std::cin>>n;
std::vector<int> vec;
int temp;
while(cin>>temp){
vec.push_back(temp);
}
for(int i = 0 ; i < n ; i++){
if(vec[i] > max ) max=vec[i];
}
std::cout<<max;
return 0;
}
with custom input it works fine.
