Question: provided code (C) not C++. it's C#include #include#define SIZE 9void readTimestamps(int x[], FILE *inp);void mergeTimestamps(int x[], int xsize, int y[], int ysize, int z[], int

provided code (C) not C++. it's C#include #include#define SIZE 9void readTimestamps(int x[], FILE *inp);void mergeTimestamps(int x[], int xsize, int y[], int ysize, int z[], int zsize);void printTimestamps(int x[], int xsize);int main(void){ int x1Size = SIZE; int x2Size = SIZE; int x3Size = SIZE; int x1[x1Size]; // initiate the array to read Timestamps from file1 int x2[x2Size]; // initiate the array to read Timestamps from file2 int x3[x3Size]; // initiate the array to read Timestamps from file3 FILE *inp; inp = fopen("timestamp1.txt", "r"); if (inp == NULL){ return -1; } else{ // your code goes here }}void readTimestamps(int x[], FILE *inp){ // reads a timestamp file into array x (assume the file store 9 ordered timestamps) }void mergeTimestamps(int x[], int xsize, int y[], int ysize, int z[], int zsize){ // merge the ordered timestamps array x[] of xsize and array y[] of ysize to generate array z[] of zsize }void printTimestamps(int x[], int xsize){ // print timestamps from array x[] }

provided code (C) not C++. it's C#include #include#define SIZE 9void readTimestamps(int x[],

In our internet infrastructure, each server is responsible for recording incoming telecommunication packets in an array as they arrive, ensuring that they are ordered according to their respective time fields within the array. Now, let's consider a scenario where an application needs to locate and sort these telecommunications packets by their timestamps across three servers. To achieve this, write a program that takes the input from three Timestamp files (each with 9 ordered timestamps) and outputs the merged and sorted packets based on their time order. Your program should use a function called printTimestamps to display the timestamps. void readTimestamps (int x, int xsize, FILE *inp) ; / / reads the timestamps from a file pointed by inp to array x[ ] with array length equal to xsize void mergeTimestamps (int x, int xsize, int y, int ysize, int z[ ], int zsize) ; / / merge the timestamps array x[ ] with array y[ ] to generate array z[ ] void printTimestamps (int x, int xsize ) ; / / prints the timestamps array x[ ] with array length equal to xsize An example of Timestamp files is given below. timestamp1: 1 3 6 9 13 16 20 25 39 timestamp2: 2 11 21 22 23 24 25 30 35 timestamp3: 3 5 10 24 30 32 33 34 35 Sample Output 1,2,3,3,5,6,9, 10,11,13,16,20,21,22,23,24,24,25,25,30,30,32,33,34,35,35,39

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!