Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. // Graham Matthews
  2. #include <iostream>
  3. #include <string>
  4.  
  5. std::string getString();
  6.  
  7. int main()
  8. {
  9. using namespace std;
  10. // a.
  11. string *strPtr1;
  12. string *strPtr2;
  13. // f
  14. double *doublePtr;
  15.  
  16. // b
  17. string *str = new string();
  18. strPtr1 = str;
  19. // c
  20. cout << "Enter a string: ";
  21. cin >> *str;
  22. // d
  23. cout << *str << " length: " << (*str).length();
  24. // e
  25. strPtr2 = str;
  26.  
  27. // g
  28. int n;
  29. cout << "Enter n: ";
  30. cin >> n;
  31. double* arr;
  32. arr = new double[n];
  33. *doublePtr = *arr;
  34.  
  35. // h
  36.  
  37.  
  38. // i
  39. delete str;
  40.  
  41. // j
  42. delete [] arr;
  43.  
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement