







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
ICE CREAM Parlor Management System in C Project Report
Typology: Translations
1 / 13
This page cannot be seen from the preview
Don't miss anything!
Introduction The Ice-cream Parlor Management System is a desktop application that allows the user to manage the di erent types of ice creams. The application allows the user to create a database of ice creams and perform various operations on the ice cream records. The user can display the list of ice creams, add new ice cream data, update the records of the ice creams, search for a specific ice cream, and delete any ice cream record. Modules
Program Source Code #include <stdio.h> #include <string.h> #define MAX_FLAVORS 10 typedef struct flavor { char name [ 20 ]; int stock; } Flavor; Flavor flavors [MAX_FLAVORS]; int num_flavors = 0 ; void add_flavor ( char * name , int stock ) {
if (num_flavors == MAX_FLAVORS) {
printf ( "Maximum number of flavors reached. \n " ); return ; } for ( int i = 0 ; i < num_flavors; i ++ ) { if ( strcmp ( flavors [i]. name , name) == 0 ) { printf ( "Flavor already exists. \n " ); return ; } } Flavor new_flavor; strcpy ( new_flavor. name , name); new_flavor. stock = stock; flavors [num_flavors] = new_flavor; num_flavors ++ ; printf ( "Flavor added successfully. \n " ); } void remove_flavor ( char * name ) { for ( int i = 0 ; i < num_flavors; i ++ ) { if ( strcmp ( flavors [i]. name , name) == 0 ) { for ( int j = i; j < num_flavors - 1 ; j ++ ) { flavors [j] = flavors [j + 1 ]; } num_flavors -- ; printf ( "Flavor removed successfully. \n " ); return ; } } printf ( "Flavor not found. \n " ); } void print_flavors () {
printf ( "Flavors available: \n " ); for ( int i = 0 ; i < num_flavors; i ++ ) { printf ( "%s - %d \n " , flavors [i]. name , flavors [i]. stock ); } } int main () {
int choice, stock; char name [ 20 ]; do { printf ( " \n 1. Add flavor \n " ); printf ( "2. Remove flavor \n " ); printf ( "3. View available flavors \n " ); printf ( "4. Exit \n " ); printf ( "Enter your choice: " ); scanf ( "%d" , & choice); switch (choice) { case 1 : printf ( "Enter flavor name: " ); scanf ( "%s" , name); printf ( "Enter stock: " ); scanf ( "%d" , & stock ); add_flavor (name, stock); break ; case 2 : printf ( "Enter flavor name: " ); scanf ( "%s" , name); remove_flavor (name); break ; case 3 : print_flavors (); break ; case 4 : printf ( "Exiting... \n " ); break ; default : printf ( "Invalid choice. \n " ); break ; } } while (choice != 4 );
return 0 ; }
Thank You