Witam, mam problem z usunięciem dynamicznej tablicy obiektów. W jaki sposób to zrobić?
#include "plik.h"
#include <fstream>
using namespace std;
int main()
{
ifstream file("dane.txt");
int a, pom1;
string pom2;
if (file.good())
{
file >> a;
Osoba *tab = new Osoba[a];
while (!file.eof())
{
for (int i = 0; i < a; i++)
{
file >> pom1 >> pom2;
tab[i].setW(pom1);
tab[i].setI(pom2);
}
}
}
else
{
cout << "Otwarcie pliku nie powiodlo sie!";
exit(0);
}
file.close();
delete[] tab;
system("PAUSE");
}
W moim kodzie wyświetla błąd że tab nie jest zadeklarowane.