|
|
back to boardtext 9 Runtime error (access violation) #include <stdio.h> #include <math.h> #define N 100000 int main(){ double n; double line[N]; int i = 0 ;
while(scanf("%lf",&n) != EOF) { line[i++] = n; } while(i-- > 1) { printf("%0.4lf\n",sqrt(line[i])); } printf("%0.4lf",sqrt(line[i])); return 0; } Re: text 9 Runtime error (access violation) > #define N 100000 Why do you think 100,000 is enough? Why do you place so big arrays on stack? You should better use std::vector or dynamic allocation. Why do you have 2 equal "printf" lines? You should better change "while" condition. |
|
|