c++ - Vector declaration globally and in the main class -
i writing code , in when declare vector globally , gives wrong answer when declare in main function . becomes right . want know difference between 2 declarations this code find min of first enteries, , 2nd min of 2nd enteries , if min >= 2nd min print no . here declared vector in main class when declare ints declared , site on submitting gives me wrong answer. #include<iostream> #include<algorithm> #include<vector> #include<cstdio> using namespace std; #define max 20000; int a,b,c,d,i,z; int main() { scanf("%d %d", &a, &b); while( a!=0 && b!=0) { z = max; for(i=0;i<a;i++) { scanf("%d",&c); if(z>c) { z=c; } } vector<int> v; for(i=0;i<b;i++) { scanf("%d",&d); ...