You should used unsigned instead of int when it can/will never be negative.
You should always return 0 from main.
This compiles fine on GCC 4.8 and 4.9.
I'd also note that using cin >> test[i] is horrible as it won't handle any invalid input correctly. Look at using std::getline() and doing type conversions with stringstream or boost::lexical_cast<>()