Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include #define MAX _ ATTENDEES 5 0 0 #define MAX _ NAME _ LENGTH 1 0 0 #define MAX _ EMAIL _

#include
#include
#include
#include
#define MAX_ATTENDEES 500
#define MAX_NAME_LENGTH 100
#define MAX_EMAIL_LENGTH 100
#define MAX_LINE_LENGTH 256
// Structure to hold attendee information
typedef struct {
char name[MAX_NAME_LENGTH];
char email[MAX_EMAIL_LENGTH];
float duration;
} Attendee;
// Function to compare attendee names for sorting
int compareAttendees(const void *a, const void *b){
Attendee *attendeeA =(Attendee *)a;
Attendee *attendeeB =(Attendee *)b;
return strcmp(attendeeA->name, attendeeB->name);
}
int main(int argc, char *argv[]){
if (argc 3|| argc >4){
printf("Usage: %s []
", argv[0]);
return 1;
}
char *inputFileName = argv[1];
float minDuration = atof(argv[2]);
int sorted =0;
if (argc ==4 && strcmp(argv[3], "sorted")==0){
sorted =1;
}
FILE *file = fopen(inputFileName,"r");
if (file == NULL){
printf("Could not open file %s
", inputFileName);
return 1;
}
Attendee attendees[MAX_ATTENDEES];
int numAttendees =0;
// Read file line by line
char line[MAX_LINE_LENGTH];
while (fgets(line, sizeof(line), file)!= NULL){
// Parse line and extract attendee information
// You'll need to implement this part based on the input format
// Parse the line into name, email, join time, leave time, and duration
// Store the attendee information in the attendees array
}
fclose(file);
// If sorted option is specified, sort attendees array by name
if (sorted){
qsort(attendees, numAttendees, sizeof(Attendee), compareAttendees);
}
// Output attendee information based on minDuration
for (int i =0; i numAttendees; i++){
if (attendees[i].duration >= minDuration){
printf("%s %.2f
", attendees[i].name, attendees[i].duration);
}
}
return 0;
} bu kodda baz hatalar var sanirim benden istenilen outputlari alamiyorum iste benden beklenen outputlar : Case 1--- Expected output (text)---
Duman Feyza Nur 122.00
YILMAZ Eda Nur 97.00
YAMAC Serhat Gokhan 118.00
Yamac Duru 117.00
Gencel Asya Hale 118.00
Ceyhun Taner 117.00
TERZI Sevil 110.00
Tekin Ilhan 118.00
Safak Aytekin 120.00 Case 2 : --- Expected output (text)---
Ceyhun Taner 117.00
Duman Feyza Nur 122.00
Gencel Asya Hale 118.00
Safak Aytekin 120.00
Tekin Ilhan 118.00
TERZI Sevil 110.00
Yamac Duru 117.00
YAMAC Serhat Gokhan 118.00
YILMAZ Eda Nur 97.00 Case 3 : --- Expected output (text)---
Duman Feyza Nur 122.00
YAMAC Serhat Gokhan 118.00
Gencel Asya Hale 118.00
Tekin Ilhan 118.00
Safak Aytekin 120.00 Case 4 : --- Expected output (text)---
Duman Feyza Nur 122.00
Gencel Asya Hale 118.00
Safak Aytekin 120.00
Tekin Ilhan 118.00
YAMAC Serhat Gokhan 118.00 Case 5 : --- Expected output (text)---
YAMAC Serhat Gokhan 118.00
Gencel Asya Hale 118.00
Yilmaz Eda Nur 95.00
Ceyhun Taner 61.00
TERZI Sevil 85.00 Case 6 : --- Expected output (text)---
Ceyhun Taner 61.00
Gencel Asya Hale 118.00
TERZI Sevil 85.00
YAMAC Serhat Gokhan 118.00
Yilmaz Eda Nur 95.00 Case 7 : --- Expected output (text)---
YAMAC Serhat Gokhan 118.00
Gencel Asya Hale 118.00
Yilmaz Eda Nur 95.00
TERZI Sevil 85.00 Case 8 : --- Expected output (text)---
Gencel Asya Hale 118.00
TERZI Sevil 85.00
YAMAC Serhat Gokhan 118.00
Yilmaz Eda Nur 95.0 Case 9 : --- Expected output (text)---
YAMAC Serhat Gokhan 118.00
Gencel Asya Hale 118.00
Yilmaz Eda Nur 95.00
Ceyhun Taner 177.00
TERZI Sevil 85.00
Yilmaz Eda 35.00 Case 10 : --- Expected output (text)---
Ceyhun Taner 177.00
Gencel Asya Hale 118.00
TERZI Sevil 85.00
YAMAC Serhat Gokhan 118.00
Yilmaz Eda 35.00
Yilmaz Eda Nur 95.00 Case 11 : --- Expected output (text)---
YAMAC Serhat Gokhan 118.00
Gencel Asya Hale 118.00
Yilmaz Eda Nur 95.00
Ceyhun Taner 177.00
TERZI Sevil 85.00 Case 12 : --- Expected output (text)---
Ceyhun Taner 177.00
Gencel Asya Hale 118.00
TERZI Sevil 85.00
YAMAC Serhat Gokhan 118.00
Yilmaz Eda Nur 95.00 Case 13 : --- Expected output (text)---
YAMAC Serhat Gokhan 118.00
Gencel Asya Hale 118.00
Yilmaz Eda Nur 95.00
Ceyhun Taner 177.00
TERZI Sevil 85.00
Yilmaz Nur Eda 35.00
YAMAC Serhat Gokhan Ali 58.00 Case 14 : --- Expected output (text)---
Ceyhun Taner 177.00
Gencel Asya Hale 118.00
TERZI Sevil 85.00
YAMAC Serhat Gokhan 118.00
YAMAC Serhat Gokhan Ali 58.00
Yilmaz Eda Nur 95.00
Yilmaz Nur Eda 35.00 Case 15 : --- Expected output (text)---
YAMAC Serhat Gokhan 118.00
Gencel Asya Hale 118.00
Yilmaz Eda Nur 95.00
Ceyhun Taner 177.00 Case 16 : --- Expected output (text)---
Ceyhun Taner 177.00
Gencel Asya Hale 118.00
YAMAC Serhat Gokhan 118.00
Yilmaz Eda Nur 95.00 Case 17 : --- Expected output (text)---
Duman Feyza Nur 122.00
YILMAZ EDA NUR 97.00
Terzi Sevil 112.00
YAMAC Serhat Gokhan 118.00
Yamachan Duru 117.00
Gencel Asya Hale 118.00
Ceyhun Tanercan 1.00
Ceyhun Taner 116.00
Tekin Ilhan 118.00
Safak Aytekin 120.00 YLMAZ EDANUR 75.00 Case 18 :
image text in transcribed

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

1. Speak privately if possible; dont threaten.

Answered: 1 week ago

Question

Will it ever be executed?

Answered: 1 week ago

Question

Does it make clear how measurements are defined?

Answered: 1 week ago

Question

How will your strategy receive approval?

Answered: 1 week ago