Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5. int main ()
  6. {
  7.  
  8. int numTests,ent;
  9. int * iPtr = new int[numTests];
  10.  
  11. while(true)
  12. {
  13. int * iPtr = new int[numTests];
  14. cout << "[1] memoria dinamicamente;\n[2]Liberar memoria dinamicamente alocada;\n[3]Listar memoria dinamicamente alocada;\n[4]Atribuir valor a memoria alocada dinamicamente;";
  15. cin >> ent;
  16. system("cls");
  17. switch(ent)
  18. {
  19.  
  20. case 1:
  21. cout << "Informe o numero da sua lista\n";
  22. cin >> numTests;
  23. system("pause");
  24. system("cls");
  25. break;
  26. case 2:
  27. delete iPtr;
  28. system("pause");
  29. system("cls");
  30. break;
  31. case 3:
  32. for (int i = 0; i < numTests; i++)
  33. {
  34. //cout da lista
  35. cout << "Item Listados" << iPtr[i] << endl;
  36. }
  37. system("pause");
  38. system("cls");
  39. break;
  40. case 4:
  41. for (int i = 0; i < numTests; i++)
  42. {
  43. //preecher o espaço de memoria
  44. cout << "\nDigite o valor da posicao " << i + 1 << " : ";
  45. cin >> iPtr[i];
  46. }
  47. system("pause");
  48. system("cls");
  49. break;
  50.  
  51. }
  52. }
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement