i am having trouble with the bold section of my code.
i want to make a function that calls that segment. getData()
i have tried to do this myself, and ask my teacher. but she is hard to get a hold of..
If you want to write a function, you need to ask yourself these questions:
What will it do?
This one's simple because you already have the code
What does it need to work?
In this case you need the file object and menuItemType array. We'll pass those as parameters.
What will it return?
Here you don't really need to return anything, so the function can be void. You could, however make it return the menuItemArray, but I'll do it the other way..
Now put it all together:
1 2 3
void getData(ifstream inFile, menuItemType menuList[]){
//Your code goes here
}
wow, youre awesome. thanks a bunch. one question though. what would the prototype look like? since if i put it where it belongs menuItemType would not have been declared yet.
would it be void getData()?
it is also saying menuItem is undeclared this is because its outside the function.
can you help me use the scope resolution operator as i am unfamiliar with it.