Skip to content

The program allows a yoga studio to find loyal customers who have attended a certain number of lessons from a dataset. It reads customer information from a file and searches for customers who meet the specified lesson count.

Notifications You must be signed in to change notification settings

C-Coding-Assignments/Yoga-Studio-Search-Part-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Yoga Studio Customer Search Program 🧘‍♀️

The program allows a yoga studio to find loyal customers who have attended a certain number of lessons from a dataset. It reads customer information from a file and searches for customers who meet the specified lesson count.


Table of Contents 📖

Task 🛠️

Write a C program to search a list of customers based on the number of lessons they have attended. The program should read customer data from a file, search for customers who have attended more than a specified number of lessons, and then write the results to an output file.


Input and Output 🖥️

Input

  • A file customers.csv containing customer data in the format:
    • email_address, number_of_lessons, name (one customer per line).
  • The user will input the minimum number of lessons to search for.

Output

  • The program will generate an output file result.csv containing customers who have attended more than the specified number of lessons. The output format should match the input format.

Examples 📋

Example #1

Enter number of lessons: 15
Output file name: result.csv

Explanation:

  • The program reads customer data from customers.csv, searches for those who have attended more than 15 lessons, and writes the result to result.csv.

Requirements ✔️

  1. The program must include the function:
    • int search(struct customer list[], int n, int num_lessons, struct customer result[]);
    • The function should search the customer list and store customers with more than num_lessons in the result array.
    • The program should handle reading and writing files as described in the input and output sections.
  2. The input file format should be as specified with each customer on a new line, including the email address, number of lessons, and name.
  3. The program should handle at most 200 customers.

Usage 🚀

1. Compile the Program:

gcc -o yoga_studio_search yoga_studio_search.c

2. Run the Program:

./yoga_studio_search

3. Input Required:

  • Number of lessons to search for.
  • Output file name.

About

The program allows a yoga studio to find loyal customers who have attended a certain number of lessons from a dataset. It reads customer information from a file and searches for customers who meet the specified lesson count.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages