I'm currently stuck on a homework problem. The questions asks "Assuming you have created the Speaker struct described in the accompanying question, write a getSpeaker function that creates a dynamically-allocated Speaker pointer, fills it's member variables with user input, and returns the pointer to the calling function.".
I have already did the part for the accompanying question correctly.
I'm just confused on what I'm doing wrong for the function and function call itself. Any help would be appreciated.
Function call starts on line 43 and the function itself is on line 56.
1) A pointer to an int is int* instead of *int
2) getSpeaker returns a Speaker struct not a int*
3) cout doesn't have an overloaded operator that takes in a random structure (like Speaker) at least if that's what you're trying to print. You either make one (not beginner stuff) or you pass the elements of the stuct individually (like ptr->name)
5) You fill-out the speaker data pass it to getSpeaker, don't do anything with it and then fill out a new Speaker. This could be correct syntactically but it seems to lack any functionality.
I just don't get why i get red squigglies when I create the dynamic part on line 61. After that, the cin statements have a red squiggly under the s before the arrow and a red squiggly under the s in the return statement on line 74. Am I doing something wrong?