Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

understanding 1) Write a program in C that stores a list of employee records in an array of structs. Each employee record should contain the

image text in transcribed

understanding

1) Write a program in C that stores a list of employee records in an array of structs. Each employee record should contain the following fields: Name (string), Age (int), Salary (float),Department (string). The program should prompt the user to enter the name of an employee, and then search the array of employee records for an employee with a matching name. If a matching employee is found, the program should print out the employee's age, salary, and department. If no matching employee is found, the program should print an error message. The program should use a linear search algorithm to find a matching employee in the array. If the employee's age is greater than 50 , their salary should be multiplied by 1.1. If the employee's age is less than or equal to 50 , their salary should be divided by 1.2. 2) Write a C program that defines a function called 'multiply_by_two' that takes an integer as an argument and returns the result of multiplying it by 2 . The main function of the program should prompt the user to enter an integer, call the 'multiply_by_two' function with the user-entered integer as an argument, and then print out the result returned by the function. In addition to the basic functionality described above, the program should also have the following features:The program should continue to prompt the user for integers and perform the multiplication until the user enters a negative number. 3) The program should keep track of the total number of multiplications performed and the total sum of all the results, and should print out these values after the user has entered a negative number. The program should define a second function called 'is_even' that takes an integer as an argument and returns 1 if the number is even, and 0 if the number is odd. The 'multiply_by_two' function should use the 'is_even' function to determine whether the input number is even or odd, and should only perform the multiplication if the input number is even. If the input number is odd, the 'multiply_by_two' function should return 0 without performing the multiplication. For example, if the user enters the following integers: 5,4,3,6, the program should output: Number of multiplications: 2 Total sum of results: 32

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

3 What are the aims of appraisal?

Answered: 1 week ago

Question

7 Compare and contrast evaluative and developmental appraisal.

Answered: 1 week ago