My opinion is that you're trying to inject C-style ways of doing things inside of a C++ program.
What happens when the brand, serial_no, name, or email entered is over 20 or 30 characters? There's no safety checks here, and no way to extend it. If this is just for a simple assignment, then it's fine. But if you're actually trying to write a robust program, it won't be acceptable.
Also, global variables like your adam variable are generally frowned upon. Declare adam in main instead.
But as far as actual errors, and not just opinions:
cin>>adam.favouriteComputer;
You'll also need a way to overload the >> operator to work with a computer object.
ex:
1 2 3 4
|
std::istream& operator>>(std::istream& is, computer& comp)
{
return is >> comp.brand >> comp.serial_no >> comp.year_produce;
}
|
cout<<"year_produce:"<<year_produce
The compiler doesn't know what year_produce is by itself. You need to tell it you mean
adam.favoriteComputer.year_produce
. Same with the other variables.