help with struct program

This is a discussion on help with struct program within the C++ Programming forums, part of the General Programming Boards category; i made this program to have the user choose from a menu what they want to do then enter information ...

help with struct program

i made this program to have the user choose from a menu what they want to do then enter information about a baseball card and view the data if they want but it doesnt work right and I cant figure out whats wrong

There are a few things wrong. First of all you don't need to declare the function return type when you call it. Take out the void before Display. Also, you don't need to declare your struct baseball everytime you pass it to a function. Take out the BaseballType in both of your funtion calls in main(). Also in your funtion declaration and prototype for Entry you need it to be BaseballType *baseball, then make the function call with the & operator before baseball. That is all the errors I see. Good luck!

EDIT: You need to call the structure members with a * before baseball in the Entry function.

int main is a function. therefore, when other functions are called, the values in main go out of scope. therfore, the baseball instance of baseball type does not exist when u call the set function. on the other hand, if u used a pointer baseballtype, ur program should work.