से सी ++ वेक्टर सबस्क्रिप्ट बाहर निम्न कोड लूप के लिए पहले 10 मानों के साथ वेक्टर भरता है। लूप के लिए दूसरे में मैं वेक्टर के तत्वों को मुद्रित करना चाहता हूं। आउटपुट जे लूप से पहले cout कथन तक है। श्रेणी के बाहर वेक्टर सबस्क्रिप्ट की त्रुटि देता है।डीबग दावा विफल रहा।
#include "stdafx.h"
#include "iostream"
#include "vector"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{ vector<int> v;
cout<<"Hello India"<<endl;
cout<<"Size of vector is: "<<v.size()<<endl;
for(int i=1;i<=10;++i)
{
v.push_back(i);
}
cout<<"size of vector: "<<v.size()<<endl;
for(int j=10;j>0;--j)
{
cout<<v[j];
}
return 0;
}