Project Report CSE 1209
Project Report CSE 1209
On
Submitted By-
Maria Rahman
Roll: 2109011
16 October, 2023
Open-ended features:
1. You should use at least two user-defined functions with “call by value” and “call by
reference”.
2. You should use at least one array and one string in the whole project.
3. The project should have at least one if-else statement and one loop statement.
4. You should use ‘FILE’ to save and update data.
5. You also may choose any data types, operators, and expressions.
Result analysis:
1. Analyze the time required to complete the whole project.
2. Did you observe any invalid input or any error during run-time?
Evaluation
Open-ended features Remarks
user-defined functions
array and string
if-else statement and loop statement.
use of ‘FILE’
_______________
Signature of Examiner
2
Contents
3
1. Introduction
A medicine store management system for Admin and User panel.Admin can add or delete any
product,view all the products and read customer feedbacks.User can search from the
inventory,place order,give feedback and get recommendations or exit the program.
1.2. Objectives
1.To provide user the ability to register and login and search for the desired medicine.
2.To give the admin panel secured login and handle the inventory and check feedbacks.
3.To manage inventory.Keeping track of medicine inventory including name,price and
quantity.
2. Current works
The console prompts the role.The admin can securely login.Add or Delete products,check
feedback and see the entire inventory.Whereas the user can login by registering first.Then he
has options to look for recommendations,search from the inventory,place order or give
feedback.
3. Methodology
At the beginning user gets asked his role.Here I have used switch for further steps according to
role.Clicking 1 as admin he is asked to put the password.Only Entering the right password will
let him go for further steps.After login successfully a congratulating text is shown and many
options are given.The options are given using switch.After selecting any of those options,some
more tasks will be happening.These are mostly done using user defined funtions.If user chooses
wrong option it goes to default and shows Invalid Choice.
If the role is of an user.User also gets many options available he can choose from.
The switch is in a do while loop.So if admin or user once choose any option.It will again start
ask the role.
Most of the options are more defined using user defined functions,string library functions,if-
else statement.In the user defined function,both call by value and call by reference was used.
In the main function a lot of the thing is declared as array and strings.
4
Again at the beginning the informations about the medicine,login information is stored in a
structure.
Typedef is used to declare recommendations.And an array is used to define those
recommendations.
3.1 Flow chart
5
3.2 Hardware and Software Requirements
Operating system: Windows 10
RAM:A minimal amount of RAM should be sufficient.
Storage:Any system with a reasonable amount of free storage is suitable.
6
struct login{
char fname[100];
char lname[100];
char username[20];
char password[20];
};
struct Medicine {
char name[50];
int quantity;
int price;
};
typedef struct {
const char* symptom;
const char* medicines[3];
} Recommendation;
Recommendation recommendations[] = {
{"Headache", {"Aspirin", "Ibuprofen", "Ace"}},
{"Allergies", {"Fexo", "Cetirizine", "Diphenhydramine"}},
{"Cough", {"Dextromethorphan", "Guaifenesin", "Codeine"}},
{"Fever", {"Ace", "Ibuprofen", "Napa"}},
};
void registe();
void login();
void addMedicine(struct Medicine inventory[], int *numMedicines) ;
void addMedicineToFile(struct Medicine medicine) ;
void deleteMedicineFromFile(const char* medicineName) ;
void searchMedicine(char *medicineName) ;
void placeOrderFromFile(const char* medicineName, int orderQuantity) ;
void viewInventory() ;
void saveFeedbackToFile(const char* feedback) ;
7
void readPreviousFeedbacks() ;
int main() {
struct Medicine inventory[50];
int opt, cho, menu, user_cho;
int numMedicines = 0;
char medicineName[50];
char admin[20];
char feedback[500];
char orderedItems[50][50];
int quantities[50];
char symptom[50];
int numItems = 0;
do {
printf("\t\t\t\t\t Press ANY KEY to continue\n\n");
getch();
printf("1. Admin\n2. User\n");
scanf("%d", &opt);
switch (opt) {
case 1:
system("CLS");
printf("\t\t\t\t\t\tADMIN PANEL\n\n");
printf("Enter Admin Password: ");
scanf("%s", admin);
if (strcmp(admin, "Maria") == 0) {
printf("\t\t\t\t\t *****Successful login*****\n");
8
printf("\n\t\t\t\t\t Welcome to Inventory\n");
printf("1. Add Medicine\n");
printf("2. Delete Medicine\n");
printf("3. View Available Medicines\n");
printf("4. Read Customer Feedbacks\n");
printf("Your choice: ");
scanf("%d", &menu);
switch (menu) {
case 1:
addMedicine(inventory, &numMedicines);
break;
case 2:
printf("Enter the name of the medicine to delete: ");
scanf("%s", medicineName);
deleteMedicineFromFile(medicineName);
break;
case 3:
viewInventory(inventory, numMedicines);
break;
case 4:
readPreviousFeedbacks();
break;
default:
printf("Invalid choice. Please try again.\n");
}
} else {
printf("Wrong Password\n");
}
9
break;
case 2:
system("CLS");
printf("1. Register\n2. Login\n");
scanf("%d", &cho);
if (cho == 1) {
system("CLS");
registe();
} else if (cho == 2) {
system("CLS");
login();
}
else
{
printf("Wrong Choice");
break;
}
switch (user_cho) {
case 1:
10
printf("Enter the name of the medicine to search: ");
scanf("%s", medicineName);
searchMedicine(medicineName);
break;
case 2:
printf("Enter the name of the medicine to order: ");
scanf("%s", medicineName);
printf("Enter the quantity to order: ");
int orderQuantity;
scanf("%d", &orderQuantity);
placeOrderFromFile(medicineName, orderQuantity);
11
printf("Enter your symptom: ");
scanf("%s", symptom);
int found = 0;
for (int i = 0; i < sizeof(recommendations) / sizeof(recommendations[0]); i++)
{
if (strcmp(symptom, recommendations[i].symptom) == 0) {
found = 1;
printf("Recommended medicines for %s:\n", symptom);
for (int j = 0; j < 3; j++) {
if (recommendations[i].medicines[j] != NULL) {
printf("- %s\n", recommendations[i].medicines[j]);
}
}
break;
}
}
if (found==0) {
printf("No recommendations available for this symptom.\n");
}
break;
case 5:
exit(0);
default:
printf("Invalid choice. Please try again.\n");
}
}
}
while (1);
return 0;
}ahjfoaskfn (Font size 12, Font Name: Times New Roman, Justify Align.)
12
4.2 Sample Input Output
ADMIN PANEL
Welcome to Inventory
1. Add Medicine
2. Delete Medicine
3. View Available Medicines
4. Read Customer Feedbacks
Your choice: 1
Enter the name of the medicine: Napa
Enter the quantity: 145678
Enter the price: 5
Medicine added to inventory and records.
Press ANY KEY to continue
For User End:
UserID:m
Password:m
*******Succesful login*******
1. Search Medicine
2. Place Order
3. Give Feedback
4. Get Recommendations
5. Exit
Your choice: 1
13
Enter the name of the medicine to search: Napa
Name: Napa, Quantity: 145678, Price: 5
Press ANY KEY to continue
5. Conclusion
This project demonstrates a simple Medical Store Management System from both user and
Admin panel.There is a simple recommendation block to recommend medicine for the user
according to problem.Also to search product and place order.Also for the user to give
feedback.And the admin can manage the inventory.
References
[1] Programming in ANSI C(author: E. Balaguruswamy sir)
[2] https://www.tutorialspoint.com
14