Question

Using Structures write an interactive program in C language to create an application program for a small training company to maintain the Trainer's database. This application should be having menu options like

Creating a New Record

Reading/Listing of Records

Modify the record

Delete the record

Each Trainer record should have Trainer Name, Trainer ID, Department Name, Salary, Position, Date of Joining, etc.). The application should be designed user-friendly.

12 Feb 2025
Answer :
Word Count : 907

Here is a C program using structures and file handling to manage a trainer's database with options to create, read, modify, and delete records.  

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define FILE_NAME "trainers.dat"

struct Trainer {
    int id;
    char name[50];
    char department[50];
    float salary;
    char position[50];
    char date_of_joining[15];
};

void addTrainer() {
    FILE *file = fopen(FILE_NAME, "ab");
    struct Trainer t;
    printf("\nEnter Trainer ID: ");
    scanf("%d", &t.id);
    printf("Enter Trainer Name: ");
    scanf(" %[^\n]", t.name);
    printf("Enter Department Name: ");
    scanf(" %[^\n]", t.department);
    printf("Enter Salary: ");
    scanf("%f", &t.salary);
    printf("Enter Position: ");
    scanf(" %[^\n]", t.position);
    printf("Enter Date of Joining (DD/MM/YYYY): ");
    scanf(" %[^\n]", t.date_of_joining);

    fwrite(&t, sizeof(t), 1, file);
    fclose(file);
    printf("\nRecord added _______ __________ _____ ________ ____ ___ ________ _______ ________ _________.
____ _______ ___ _______ _______ ________ _________ _______.
____ ______ _____ _____ __________ ___ ______ ___.
________ _____ ________ _________ __________ ____ _______ _____ ______.
_________ _______ ________ _______ ______ ___ ______.
____ _____ _____ _____ __________ _____.
______ __________ ______ _________ ______.
___ _______ _________ ____ ____.
_________ ______ _____ _____ _______ ___ _____.
_____ ______ ____ _____ ________ _______ ___ _________.
_________ __________ _________ _____ ______ ____ __________ __________.
__________ _______ __________ ____ _____ __________ ________.
_________ ______ ____ _________ __________ ____ _________.
____ ________ _______ ___ ___ ______ ____.
______ ________ ________ __________ _______ __________ _____ _________ ___.
______ _________ ____ _________ _________.
________ ____ _____ _________ ___ _________ _______ ____ _________ ____ ____ _________.
_____ ________ ___ ___ _________ ______ _________.
______ ________ _____ _____ ________ ________ ______.
________ ____ ________ _______ _______ ____ ____ ____ _____.
______ __________ _________ _______ _______ _____.
__________ ______ _____ _______ __________ ______ _____ __________ ________.
________ _____ ____ ______ _________ _______ _____ __________ ___ _________.
__________ ____ __________ _____ ________ _______ ___.
______ __________ ________ _______ _____ _____ ________ _____ ______.
______ _________ ____ _________ _______ ___ _________.
____ __________ _____ ____ _____ _________ ___ _______ ___ _______ _____ ______.
__________ _______ ______ __________ __________ ________ __________ ____.
_______ ________ ______ _______ _____ ________ _____ __________ ___ __________ __________.
________ _____ _____ _____ _______ ________ __________ _______ _________ _______ ________ __________.
_______ ________ __________ __________ _____.
_______ _____ ______ _______ _______ __________ _______ _________.
___ ________ ___ _________ _________ ___ _________ _________ _____.
________ _________ __________ ___ ________ _____ _________.
_____ _______ ______ __________ __________ ________ _____ _____ _______.
_________ _______ ________ __________ _______ _________.
________ ____ ___ _____ __________ _______ __________.
____ _________ _______ _________ __________ _________ ____ __________ ____ _______ _____.
______ ____ _____ _______ ___ ___ ___ ___.
__________ _________ _________ ___ ________ _______ ______ _______.
_________ ________ __________ _________ __________.
______ _________ ______ _________ __________ ________ ________ __________ ___ ______ __________ ________.
________ __________ ________ ______ ___ _________ ____ ______ __________.
__________ _____ ______ _____ _____.
_____ ___ ________ ______ ___ ____ __________ ____ _____ ____.
__________ _______ _______ _____ __________.
_____ ____ ______ ________ ___ ____ ______ _________.
_____ _________ ____ ____ _________ _________ ______.
______ ______ ________ _________ __________ ____ ________ ______.
________ _______ _________ _________ ______ _________ _______ ________ ____ ______ ___.
_____ ________ _________ _______ ___ ____.
_______ ______ _____ ________ _______.
____ _______ _____ __________ ______ ____ _____.
__________ _________ _______ ________ _______ _________ _______ _________ ____ _______ _______ ___.
____ _________ ______ __________ _____ ____ ____ _______ ______ _______ ___ __________.
______ __________ ___ ___ __________ _____ ________ _____ ________ _________ _______.
________ _________ _____ _____ _____ ________ ____ __________ ____ _______.
______ _________ ________ _____ __________ _________ ____ ________.
______ _______ _____ _______ _________ _________ ____ ____ _______ __________.
_________ ___ _______ _______ __________ __________ ___ __________ ___ ___ __________.
____ ____ ________ _______ ____ _______ ______ ___ ___ ________ __________.
____ ____ _____ __________ ______ _____ ___ _________ _____ ________ ________ __________.
_______ ________ ____ ___ ___ __________.
________ _________ _________ __________ _______.
_________ ___ ____ __________ _______ ____.
______ ________ ______ ____ __________ __________ ___ __________ ____.
_____ _____ _______ __________ ___ ____ _________.
__________ _______ ____ _______ _______ ________ _________ __________ _______ ______ _____.
________ _________ ______ ____ __________ _____ _____ ______ _______.
_________ _______ ________ __________ _______ ______ _____ _____ ________ _______.
___ ________ ______ ______ ______ __________ ___ _________ _________ ____ ______.
_________ ________ __________ ____ __________ ______ _________ _________ _____ _________.
_______ _____ ____ ________ __________ ________ __________.
_________ __________ ___ ______ __________ __________ _______ ___ _________ ____ __________ _________.
_______ __________ _____ _____ _________.
__________ ______ _____ _____ ______ ______ ___ ________ ___ ____ _____.
______ ____ _______ _______ ________ __________.
_____ _________ ______ __________ _____ ____ ____ ______ _________ _____.
_____ _______ ___ ___ __________ _________ _______.
________ ________ _______ __________ ______.
___ __________ __________ ____ ___.
_______ ______ ______ ______ _______ ______.
_________ ___ _______ _________ ________ ________.
_____ __________ _________ ______ _________ _______ ___ ________ _____ _______.
_________ __________ ___ ________ _____ ____.
________ ________ ___ ____ ____ ______ ___ ____ _________.
_______ _______ ___ _______ ________ ___ __________ ______ _______ _______ ___.
____ __________ _________ ____ ________ _____ _____ _________ _________ ___ __________.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Using Structures write an interactive program in C language to create
🟢
WhatsApp Chat Fast live messaging
Email Us Business enquiries & support