|
|
вернуться в форумWhy Crash? Послано Tirex 29 июн 2009 01:44 #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { const unsigned int N=32768; unsigned long long xl[N]; unsigned int col=0; cin.setf(ios::skipws); while(cin>>xl[col]) col++; cout.unsetf(cout.flags()); cout.setf(ios::showpoint|ios::fixed|ios::dec); while(col--) cout<<setprecision(4)<<sqrt((double)xl[col])<<endl; return 0; } Re: Why Crash? Послано Tirex 29 июн 2009 04:19 Decided. Please explain some of the time, please. #include <iostream> #include <iomanip> #include <cmath> using namespace std; typedef unsigned long long Beta; int main() { const unsigned int N=128*1024; Beta *xl=new Beta[N]; int col=0; cin.setf(ios::skipws); while(cin>>xl[col]) col++; cout.unsetf(cout.flags()); cout.setf(ios::showpoint|ios::fixed|ios::dec); while(col--) cout<<setprecision(4)<<sqrt((double)xl[col])<<endl; delete []xl; return 0; } The size of the input stream 256 kb. So we need to allocate memory in the amount of (256*1024)/sizeof(_int64); Why is the correct decision should be 128 * 1024? |
|
|