C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

4. Consolidation may be done by writing a C++ programme. Utilise the associated hub data and sort on the related rundown.

On this page, we explore the definition of a structure in C++ to represent an employee with specific attributes. Below is an example of how to declare such a structure:

```cpp
struct employee {
    char firstName[20];
    char lastName[20];
    unsigned int age;
    char gender;
    double hourlySalary;
};
```

#### Explanation:

1. **Struct Declaration (`struct employee`)**:
   - Keyword `struct` is used to define a structure named `employee`.

2. **Members of the Structure**:
   - `char firstName[20];`: An array of characters to store the first name of the employee with a maximum length of 20 characters.
   - `char lastName[20];`: An array of characters to store the last name of the employee with a maximum length of 20 characters.
   - `unsigned int age;`: An unsigned integer representing the age of the employee.
   - `char gender;`: A single character to store the gender of the employee.
   - `double hourlySalary;`: A double type to store the hourly salary of the employee.

#### Instructions:
- **Defining Classes and Functions**:
  - According to your program requirements, define corresponding classes and functions that manage or utilize the `employee` structure.

- **Report Writing**:
  - Write a detailed report explaining your work. Ensure that the explanation is provided line by line, detailing each step and its purpose.

This information and example serve as a foundational aid for students to understand how to define and use structures in C++. The explanation and requirements can be used for programming tasks, assignments, or projects related to employee data management.
expand button
Transcribed Image Text:On this page, we explore the definition of a structure in C++ to represent an employee with specific attributes. Below is an example of how to declare such a structure: ```cpp struct employee { char firstName[20]; char lastName[20]; unsigned int age; char gender; double hourlySalary; }; ``` #### Explanation: 1. **Struct Declaration (`struct employee`)**: - Keyword `struct` is used to define a structure named `employee`. 2. **Members of the Structure**: - `char firstName[20];`: An array of characters to store the first name of the employee with a maximum length of 20 characters. - `char lastName[20];`: An array of characters to store the last name of the employee with a maximum length of 20 characters. - `unsigned int age;`: An unsigned integer representing the age of the employee. - `char gender;`: A single character to store the gender of the employee. - `double hourlySalary;`: A double type to store the hourly salary of the employee. #### Instructions: - **Defining Classes and Functions**: - According to your program requirements, define corresponding classes and functions that manage or utilize the `employee` structure. - **Report Writing**: - Write a detailed report explaining your work. Ensure that the explanation is provided line by line, detailing each step and its purpose. This information and example serve as a foundational aid for students to understand how to define and use structures in C++. The explanation and requirements can be used for programming tasks, assignments, or projects related to employee data management.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning