Reading Assignment: Structs C++
1. Why do we need structs?
When you need to keep a record for a lot of details.
2. What are members in a struct?
There are different items/variables that’s belongs to struct
3. How do you access a member inside a struct?
By creating a functions, and call the function with one of the members name
Or via direct call
std::cout << "Wage: " << employee.wage << ‘\n’;
void printInformation(Employee employee)
{
std::cout << "ID: " << employee.id << ‘\n’;
std::cout << "Age: " << employee.age << ‘\n’;
std::cout << "Wage: " << employee.wage << ‘\n’;
}
printInformation(frank);
4. What is a nested struct?
It’s a struct that contains other structs