Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- int main ()
- {
- int numTests,ent;
- int * iPtr = new int[numTests];
- while(true)
- {
- int * iPtr = new int[numTests];
- cout << "[1] memoria dinamicamente;\n[2]Liberar memoria dinamicamente alocada;\n[3]Listar memoria dinamicamente alocada;\n[4]Atribuir valor a memoria alocada dinamicamente;";
- cin >> ent;
- system("cls");
- switch(ent)
- {
- case 1:
- cout << "Informe o numero da sua lista\n";
- cin >> numTests;
- system("pause");
- system("cls");
- break;
- case 2:
- delete iPtr;
- system("pause");
- system("cls");
- break;
- case 3:
- for (int i = 0; i < numTests; i++)
- {
- //cout da lista
- cout << "Item Listados" << iPtr[i] << endl;
- }
- system("pause");
- system("cls");
- break;
- case 4:
- for (int i = 0; i < numTests; i++)
- {
- //preecher o espaço de memoria
- cout << "\nDigite o valor da posicao " << i + 1 << " : ";
- cin >> iPtr[i];
- }
- system("pause");
- system("cls");
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement