This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Which header should I include for "reverse"


Hi, Everyone:

I compiled a short program to use "reverse" like this:

#include <iostream>
#include <algorithm>

int main() {

double A[6] = { 1.2, 1.3, 1.4, 1.5, 1.6, 1.7 };
reverse(A, A + 6);
for (int i = 0; i < 6; ++i)
std::cout << "A[" << i << "] = " << A[i];
return 0;
}

But the error is:
reverse.cpp: In function `int main()':
reverse.cpp:7: error: `reverse' undeclared (first use this function)
reverse.cpp:7: error: (Each undeclared identifier is reported only once for
  each function it appears in.)

Thanks in advance!

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]