|
|
back to boardwhy i get Runtime error (access violation) #include<iostream> #include<cmath> #include<iomanip> using namespace std; int main() { long long a[100000] = {0}; int i = 0; while (cin >> a[i]) { i++; } for (int j = i-1; j >= 0; j--) { cout << fixed << setprecision(4) << sqrt(a[j]) << endl; } } Re: why i get Runtime error (access violation) How did you think "100,000" is enough for the input? You shouldn't allocate big arrays on stack. You should allocate big array in heap or use vector. |
|
|