|  | 
|  | 
| back to board | whats wrong here please ? Posted by MyName  21 Jul 2015 17:00#include <iostream>#include <string>
 #include <cstdlib>
 #include <cmath>
 #include <sstream>
 #include <vector>
 #include <stdio.h>
 
 using namespace std;
 
 int main()
 {
 string s="";
 vector <long double> vec;
 
 cout<<vec.size();
 long double j;
 char c;
 stringstream ss("");
 for (int i=0;i<256000;i++)//This is here so I can handle the size of the stream input
 {
 cin.get(c);
 s+=c;
 }
 //Now I know I am working on 256KB
 ss<<s;
 
 while(ss>>j)
 {
 j=sqrt(j);
 
 vec.push_back(j);
 }
 
 for (int k=vec.size()-1;k>=0;k--)
 {
 cout.precision(4);
 cout<<fixed<<vec[k]<<endl;
 }
 
 return 0;
 }
Re: whats wrong here please ? Posted by MyName  21 Jul 2015 18:24I should add a test, if we are in the end of file before the 256000. Otherwise, it'll wait for 256000 char to enter | 
 | 
|