|
|
вернуться в форумwhy c++ use vector<double> got access violation? Послано tcltsh 13 окт 2013 05:31 #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> #include <vector> #include <cmath> using namespace std; vector<double> num; int main() { double now; while(!scanf("%lf", &now)) { num.push_back(now); } for (unsigned i = num.size()-1; i>=0; --i) { printf("%.4lf\b", sqrt(num[i])); } return 0; } -- use a array[200000] got AC, but why vector failed? Re: why c++ use vector<double> got access violation? If the input is empty, "num.size()-1" is a huge positive integer |
|
|