samedi 14 mars 2015

xcode: undeclared identifier for vector


I am writing a very simple c++ code using xcode, but it kept returning undeclared identifier for i I'm really confused.



#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {

vector <int> v(4);
v [0] = 25;
v [1] = 15;
v [2] = 10;
v [3] = 5;

sort (v.begin(), v.end());

for (int i=0; i< v.size(); i++);
cout << v[i]<< " ";
cout << endl;

return 0;
}



Aucun commentaire:

Enregistrer un commentaire