/*
 * Author: Iván Iglesias
 * Date: 23-11-2026
 * Description: PR2 - The goal of this exercise is to replace the parallel vector implementation 
 * with a design based on hierarchical data structures (tuples) 
 * and to break the code down into actions and functions.
 */

/* ------------------------------- */

/* System header files */
#include "maintenance.h"
#include <stdio.h>
#include <stdlib.h>

/* Main function */
int main(void)
{
    char filename[256];
    tWagonSensors sensors;
    tInspectionResult result;
    bool isRead;

    printf("--- WAGON INSPECTION SYSTEM (PR2 - MODULAR) ---\n");
    printf("LOAD DATA FROM FILE. ENTER FILE NAME >> ");

    if (scanf("%255s", filename) != 1)
    {
        printf("Error: Could not read file name\n");
        return EXIT_FAILURE;
    }

    /* Exercise 1: load sensor data */
    loadWagonFromFile(filename, sensors, &isRead);

    if (!isRead)
    {
        printf("Error: Could not open or read file\n");
        return EXIT_FAILURE;
    }

    /* Exercise 2: calculate inspection results */
    inspectWagon(sensors, &result);

    /* Exercise 3: display the results */
    displaySummary(sensors, result);

    return EXIT_SUCCESS;
}



















Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: