|
|
back to boardMemory exceeded Posted by Ankita 13 Nov 2014 22:29 Hi, This is my code: #include <iostream> #include <vector> #include <cmath> #include <iomanip> using namespace std; int main() { vector<int> V; V.resize(0); int n; cin >> n; while( n != EOF) { V.resize(V.size() + 1); V.push_back(n); cin >> n; } cout << setprecision(4) << fixed ; while(V.size() > 0) { n = V.back(); V.pop_back(); cout << sqrt(n) << endl; } return 0; } Could someone please tell me why the memory got exceeded here ? The stream is just 256 KB, right ? Regards, Ankita |
|
|