jamesrdaza

Untitled

Jul 29th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. double* ReadData(int& size)
  9. {
  10. double* arrPoint = new double[10];
  11. int count = 0;
  12. int input;
  13. char again;
  14.  
  15.  
  16. while (cin >> input)
  17. {
  18. if (cin.fail())
  19. {
  20.  
  21. break;
  22. }
  23.  
  24. arrPoint[count] = input;
  25.  
  26. size++;
  27. count++;
  28.  
  29.  
  30. }
  31. return arrPoint;
  32. }
  33.  
  34.  
  35.  
  36. int main()
  37. {
  38.  
  39. double* pointer;
  40. int size = 0;
  41.  
  42.  
  43. cout << "Please enter the contents for the array (Enter 'q' to quit): ";
  44. pointer = ReadData(size);
  45.  
  46.  
  47. cout << endl;
  48. for (int i = 0; i < size; i++)
  49. {
  50. cout << pointer[i] << " ";
  51. }
  52.  
  53. cout << endl;
  54. cout << size;
  55. system("pause");
  56. return 0;
  57. }
Add Comment
Please, Sign In to add comment