Dynamic Arrays

Nov 30, 2014 at 3:20pm
-deleted-
Last edited on Dec 1, 2014 at 10:26am
Nov 30, 2014 at 3:24pm
-deleted-
Last edited on Dec 1, 2014 at 10:26am
Nov 30, 2014 at 4:38pm
Just some hints are okay.
Please don't post direct solutions.
I want to solve it by my own eventually.

Thanks all!
Nov 30, 2014 at 4:53pm
Step through your code using a debugger, look at the variables and how they change line by line at execution...see what works, and what isn't working...and then try and find what is different.

If you don't know about setting breakpoints in your compiler and watching variables etc...might look that up.

should show you everything you need to know about what is happening in your code.

good luck =D
Nov 30, 2014 at 5:10pm
I am assuming you have also declared two more structs elsehwere

Student* students;
Course* courses;


You are doing this wrong, I am guessing. try changing it

1
2
3
4
5
6
7
void queryE(Database d, string courseCode)
{
    for (int i = 0; i < d.numberOfEnrollRecords; i++)
    {
        EnrollRecords temp[d.numberOfEnrollRecords];//here every time it is     being newly defined
       
     


Last edited on Nov 30, 2014 at 5:13pm
Dec 1, 2014 at 1:57am
Yes I have declared

Student* students;
Course* courses;

These are used in tasks before this one...
I can handle those tasks well by myself...

Now I just cannot change the order of displaying
I am thinking... even if I change the order of the d.enrollRecords[i].exam (which is a double), its corresponding d.enrollRecords[i].uid is still the original one...


Is there any notes teaching people how to deal with this? Swaping things inside a struct and dynamic array?
Dec 3, 2014 at 1:33pm
consider pass by reference
Topic archived. No new replies allowed.