So I am doing my best to learn as much as I can about c++ and since I learned PASCAL in high school, it wasnt that difficult but I always run into some small problems, glitches and stuff, but it finally worked as for now.
Now the first problem I cant seem to solve is how to create the structure of my agenda with "new" and delete it right after with "delete[]"
This is the code so far, and I have big plans with it, but first of all I want to be able to create and delete it whenever I start it.
int main () {
int i,n;
agd a;
cout <<"Dati nr de persoane care doriti sa il introduceti in agenda: ";
cin >>n;
if (a==0) cout <<"Error allocating memory, try again with a smaller number!";
else {
creare(a,n);
afisare(a,n);
}
system("pause");
return 0;
}
So far I have tried to do something like this
agenda *a=new (nothrow)agenda[n];
but then I run into other problems like it gives me some errors like it is not right declarer into functions(tho i changed to "void creare(agenda a, int n)...")
still wont work :( or if it works, then it gives another error when im calling the function in the main program. What am I doing wrong?:(
Thanks in advance!