fork download
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<cstdio>
  4. #include<cmath>
  5.  
  6. #define MAX_SIZE 32000
  7.  
  8. using namespace std;
  9.  
  10. class Queue{
  11. private:
  12. double item[MAX_SIZE];
  13. int rear;
  14. int front;
  15.  
  16. public:
  17. Queue();
  18. void enqueue(double);
  19. void display();
  20. };
  21.  
  22. Queue::Queue(){
  23. rear = -1;
  24. front = 0;
  25. }
  26.  
  27. void Queue::enqueue(double data){
  28. item[++rear] = data;
  29. }
  30.  
  31. void Queue::display(){
  32. for(int i = rear; i >= front; i--)
  33. printf("%.4lf\n", item[i]);
  34. }
  35.  
  36.  
  37. int main(){
  38. Queue queue;
  39. long long int n;
  40. double root;
  41.  
  42. while(scanf("%lld", &n) != EOF){
  43. root = sqrt(n);
  44. queue.enqueue(root);
  45. }
  46.  
  47. queue.display();
  48.  
  49. return 0;
  50. }
  51.  
Success #stdin #stdout 0s 15368KB
stdin
 1427  0   

   876652098643267843 
5276538
stdout
2297.0716
936297014.1164
0.0000
37.7757