logo

Crowdly

Browser

Додати до Chrome

Course 31709

Шукаєте відповіді та рішення тестів для Course 31709? Перегляньте нашу велику колекцію перевірених відповідей для Course 31709 в lms.aub.edu.lb.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Employee Management System 

Write a C program that: 

  • Defines a struct Employee with the following fields: 
    • char name[50] 
    • int id 
    • float salary 
  • Dynamically allocates an array of n employees in the heap (where n is entered by the user). 
  • Reads employee data (name, ID, and salary) from the user and stores it in the allocated memory. 
  • Implements a function printEmployees to display all employee records. 
  • Implements a function findTopEmployee that returns the employee with the highest salary. 
  • Frees allocated memory before exiting. 

Example Output: 

Enter the number of employees: 3 

Enter employee 1 name: Alice 

Enter employee 1 ID: 101 

Enter employee 1 SALARY: 3800 

Enter employee 2 name: Bob 

Enter employee 2 ID: 102 

Enter employee 2 SALARY: 3500 

Enter employee 3 name: Charlie 

Enter employee 3 ID: 103 

Enter employee 3 SALARY: 3900 

Employee Records: 

Alice (ID: 101, SALARY: 3800) 

Bob (ID: 102, SALARY: 3500) 

Charlie (ID: 103, SALARY: 3900) 

Top Employee: Charlie (ID: 103, SALARY: 3900)

Переглянути це питання

#include "stdio.h"

int main()

{

struct {int a[2];} arr[] = {{1},{2}};

printf("%d %d %d %d",arr[0].a[0],arr[0].a[1],arr[1].a[0],arr[1].a[1]);

return 0;

}

Pick the best statement for the program above:

Переглянути це питання

What header file is needed to use malloc() and free()?

Переглянути це питання

We use malloc and calloc for

Переглянути це питання

Which of the following operators can be applied on structure variables?

Переглянути це питання

What is the return type of malloc() or calloc()

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на lms.aub.edu.lb?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome