Saad Dahlab university 1st year / Math
Faculty of Science ADS2
Set 8 exercises: Structures
Exercise 1 : (Lecture)
Define an employee structure that includes the following members: Name, date of birth,
role, hiring date, salary.
Write an algorithm that:
1. Read for the information of n given employee (where n ≤ 100).
2. Displays the information of employees with a salary <= 30000 DZD.
3. Displays the information of the employee with the highest salary.
4. Displays the total salary mass of the employees.
Exercise 2: Managing Complex Numbers
A complex number is defined by:
• Real part (real number)
• Imaginary part (real number)
1. Declare a structure ComplexNumber.
2. Write an algorithm that:
• Input n (n<=10) complex numbers.
• Calculates and display the sum of all complex numbers.
• Calculates and display the product of the first and last complex numbers.
formula: (𝒂 + 𝒃𝒊) ∗ (𝒄 + 𝒅𝒊) = (𝒂𝒄 − 𝒃𝒅) + (𝒂𝒅 + 𝒃𝒄)𝒊
Exercise 3: Solving Linear Systems (2x2)
We want to solve a system of equations in the form:
• a_1x + b_1y = c_1
• a_2x + b_2y = c_2
The coefficients are stored in a structure:
a , b, c : real numbers
1. Declare a structure Equation.
2. Write an algorithm that :
• Inputs two equations.
• Solves the system using Cramer’s method: