Page 1 of 2 12 LastLast
Results 1 to 12 of 18

Thread: Medical Store Management System

  1. #1
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 01:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    30
    Gender
    Male
    Posts
    639
    Threads
    55
    Credits
    0
    Thanked
    105

    Default Medical Store Management System

    main ny Medical Store Management System project bnaya socha ap k sth bhi share kr du
    SCREEN SHOTS:

    [ATTACH][ATTACH]Name:  3.PNG
Views: 1126
Size:  18.5 KB[/ATTACH][/ATTACH]

    CODE:
    #include <iostream>
    #include <fstream>
    #include <windows.h>
    #include <string>
    #include <sstream>

    using namespace std;
    int main();
    ofstream fout;
    ifstream fin;
    class Medicine{
    public:
    string name;
    string weight;
    string type;
    string expiryDate;
    double price;
    Medicine(){
    price = 0.0;
    }
    };
    void DisplyMed(Medicine m){
    cout << endl;
    cout << "\tMedicine : " << m.name << endl;
    cout << "\tType : " << m.type << endl;
    cout << "\tWeight : " << m.weight << endl;
    cout << "\tExpiry Date : " << m.expiryDate << endl;
    cout << "\tPrice Rs. " << m.price << endl;
    }
    // Node for Linked list
    class mNode{
    public:
    Medicine m;
    mNode *next;
    mNode(){
    next = NULL;
    }
    };
    //Linked List class for Medicine
    class mList{
    mNode *head;
    public:
    mList(){
    head = NULL;
    }
    void addTofile();
    bool isEmpty();
    void addMedicine(Medicine newMedicine);
    void searchMedicine(string mName);
    void DisplayMed(string mType);
    void removeMedicine(string mName);
    void showM_List();
    void countMedicine();
    }newList;
    // to check list is empty or not
    void mList::addTofile(){
    mNode *temp = head;
    while (temp != NULL){
    Medicine m = temp->m;
    fout << temp->m.name << "," << temp->m.type << "," << temp->m.weight << "," << temp->m.expiryDate << temp->m.price << "\n";
    temp = temp->next;
    }
    fout.close();
    delete temp;
    }
    bool mList::isEmpty(){
    return(head == NULL);
    }
    // to add medicine at end
    void mList::addMedicine(Medicine newMedicine){
    if (head == NULL){
    head = new mNode;
    head->m = newMedicine;
    head->next = NULL;
    }
    else if (head->next == NULL){
    head->next = new mNode;
    head->next->m = newMedicine;
    head->next->next = NULL;
    }
    else{
    mNode *temp = head;
    while (temp->next != NULL){
    temp = temp->next;
    }
    temp->next = new mNode;
    temp->next->m = newMedicine;
    temp->next->next = NULL;
    }
    }
    // searching medicine by name
    void mList::searchMedicine(const string mName){
    if (isEmpty()){
    cout << "\tEmpty List!" << endl;
    }
    else{
    mNode *temp = head;
    bool found = false;
    while (temp != NULL && !found){
    if (temp->m.name == mName){
    found = true;
    break;
    }
    else{
    temp = temp->next;
    }
    }
    if (found){
    DisplyMed(temp->m);
    }
    else{
    cout << "/tMedicine not Found!" << endl;
    }
    }

    }
    // to display medicine of same type
    void mList:isplayMed(string mType){
    if (isEmpty()){
    cout << "\tEmpty List!" << endl;
    }
    else{
    mNode *temp = head; bool c = false;
    while (temp != NULL){
    if (temp->m.type.compare(mType) == 0){
    c = true;
    DisplyMed(temp->m);
    cout << endl;
    }
    temp = temp->next;
    }
    delete temp;
    if (!c){
    cin.get();
    cout << "\tNo Medicines found of " << mType << " Type."
    << endl;
    Sleep(1000);
    }

    }
    }
    // to display all Medicines in the list
    void mList::showM_List(){
    if (isEmpty()){
    cout << "Empty List!" << endl;
    }
    else{
    mNode *temp = head;
    while (temp != NULL){
    DisplyMed(temp->m);
    temp = temp->next;
    }
    delete temp;
    }

    }
    void mList::removeMedicine(string mName){
    if (isEmpty()){
    cout << "\tEmpty List!" << endl;
    }
    else if ((head->next) == NULL && (head->m.name == mName)){
    head = NULL;
    cout << "\tMedicine Deleted!" << endl;
    }
    else if (head->m.name == mName){
    head = head->next;
    cout << "\tMedicine Deleted!" << endl;
    }
    else{
    mNode *temp = head;
    mNode *prev = NULL;
    bool found = false;
    while (temp != NULL && !found){
    if (temp->m.name == mName){
    found = true;
    break;
    }
    prev = temp;
    temp = temp->next;
    }
    if (found){
    prev->next = temp->next;
    cout << "\tMedicine Deleted!" << endl;
    }
    else{
    cout << "Medicine not Found!" << endl;
    }
    }

    }
    void mList::countMedicine(){
    int count = 0;
    mNode *temp = head;
    while (temp != NULL){
    count++;
    temp = temp->next;
    }
    cout << "\tNumber of Medicine(s) in the "
    << "List is " << count << endl;
    delete temp;

    }
    void displayNote(){
    cout << "Note : You can only Add 3 types of Medicines." << endl;
    cout << "\t1.Liquid\n\t2.Tablet\n\t3.Capsules\n";
    cout << "\tYour Choice : ";
    }
    void displayMenu(){
    cout << "\t\t\tMedical Store Managment!\n\n\n";
    cout << "\t1.To ADD new Medicine." << endl;
    cout << "\t2.To REMOVE Medicine." << endl;
    cout << "\t3.To FIND Medicine by Name." << endl;
    cout << "\t4.To SHOW Medicines of same Type." << endl;
    cout << "\t5.To DISPLAY all Medicines." << endl;
    cout << "\t0. To EXIT. " << endl;
    cout << "\tYour Choice : ";
    }
    void case0(){
    cin.get();
    if (newList.isEmpty()){
    exit(0);
    }
    else{
    char c;
    cout << "\tDo you Want to save List for Later use? (y/n) : ";
    cin >> c;
    if (c == 'n' || c == 'N'){
    fout.open("data.txt", ios::trunc);
    fout.close();
    }
    if (c == 'y' || c == 'Y'){
    fout.open("data.txt", ios:ut & ios::trunc);
    if (!fout){
    system("cls");
    cout << "\tError Creating File!" << endl;
    }
    else{
    newList.addTofile();
    cout << "List Added to File!" << endl;
    }
    }
    }
    }
    void case1(){
    system("cls");
    displayNote();
    Medicine nM;
    char c;
    cin >> c;
    if ((c < '1') || (c > '3')){
    case1();
    }
    system("cls");
    cout << "Enter Med's Name: ";
    cin >> nM.name;
    if (c == '1'){
    nM.type = "Liquid";
    }
    if (c == '2')
    nM.type = "Tablet";
    if (c == '3')
    nM.type = "Capsules";
    if (c == '1'){
    cout << "Enter Med's Quantity(ml) : ";
    cin >> nM.weight;
    }
    else{
    cout << "Enter Med's Weight(mg) : ";
    cin >> nM.weight;
    }
    cout << "Enter Expiry Date (dd/mm/yyyy) : ";
    cin >> nM.expiryDate;
    cout << "Enter Med's Price : ";
    cin >> nM.price;
    newList.addMedicine(nM);
    system("cls");
    cout << "\tMedicine Added!";
    Sleep(1000);
    system("cls");
    main();
    }
    void case2(){
    system("cls");
    if (newList.isEmpty()){
    cout << "Empty List! Nothing to Remove." << endl;
    }
    else{
    string name;
    cout << "\tEnter Med's Name to Delete : ";
    cin >> name;
    newList.removeMedicine(name);
    }
    Sleep(2000);
    system("cls");
    main();
    }
    void case3(){
    if (!newList.isEmpty()){
    system("cls");
    string name;
    cout << "Enter Medicine Name to Find : ";
    cin >> name;
    newList.searchMedicine(name);
    system("pause");
    }
    else{
    system("cls");
    cout << "\tEmpty List\n";
    system("pause");
    }
    system("cls");
    main();
    }
    void case4(){
    system("cls");
    if (newList.isEmpty()){
    cout << "\tNo Medicines in the List!" << endl;
    Sleep(2000);
    }
    else{
    cout << "Note.Following Med's type could in the List\n";
    cout << "\t1.Liquid\n\t2.Tablet\n\t3.Capsules\n";
    cout << "\tYour Choice : "; char c;
    cin >> c;
    system("cls");
    if (c <'1' || c > '3'){
    case4();
    }
    if (c == '1')
    newList.DisplayMed("Liquid");
    if (c == '2')
    newList.DisplayMed("Tablet");
    if (c == '3')
    newList.DisplayMed("Capsules");
    system("pause");
    }
    system("cls");
    main();
    }
    void case5(){
    system("cls");
    if (!newList.isEmpty()){
    newList.countMedicine();
    }
    newList.showM_List();
    system("pause");
    system("cls");
    main();
    }
    void caseD(){
    system("cls");
    system("color 4F");
    cout << "\n\n\n\n\n\n\n\n\n\n\t\t\t\tInvalid Input!" << endl;
    Sleep(2000);
    system("color F0");
    system("cls");
    main();
    }
    void filecheck()
    {
    fin.open("data.txt", ios::in | ios::beg);
    if (!fin.is_open())
    {
    cerr << "\tError Opening File!\n";
    }
    else
    {
    Medicine m;
    string line;
    while (getline(fin, line))
    {
    stringstream newL(line);
    string s;
    int c = 0;
    while (getline(newL, s, ','))
    {
    if (c == 0)
    {
    m.name = s;
    }
    if (c == 1)
    {
    m.type = s;
    }
    if (c == 2)
    {
    m.weight = s;
    }
    if (c == 3)
    {
    m.expiryDate = s;
    }
    if (c == 4){
    m.price = atof(s.c_str());
    }
    c++;
    }
    newList.addMedicine(m);
    }

    }
    fin.close();
    }

    char c = '0';
    int main()
    {
    system("color F0");
    if (c == '0'){
    filecheck();
    c = '1';
    }
    char choice;
    displayMenu();
    cin >> choice;
    switch (choice){
    case '0':
    case0();
    break;
    case '1':
    case1();
    break;
    case '2':
    case2();
    break;
    case '3':
    case3();
    break;
    case '4':
    case4();
    break;
    case '5':
    case5();
    break;
    default:
    caseD();
    }
    return 0;
    }
    Attached Images Attached Images   
    Shadow xXx

  2. #2
    AsifSattarvi's Avatar
    AsifSattarvi is offline Advance Member
    Last Online
    12th October 2022 @ 02:54 PM
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,594
    Threads
    104
    Credits
    30,058
    Thanked
    960

    Default

    بہت شکریہ برادر ہمارے ساتھ شئیر کرنے کا
    آپ کی اگلی شئیرینگ کا بھی انتظار رہے گا
    جزاک اللہ

  3. #3
    dxtyle's Avatar
    dxtyle is offline Advance Member
    Last Online
    26th February 2024 @ 08:27 PM
    Join Date
    01 Oct 2009
    Location
    LoadIng....
    Gender
    Male
    Posts
    2,219
    Threads
    97
    Credits
    3,040
    Thanked
    64

    Default

    nice

  4. #4
    MarhabaG is offline Member
    Last Online
    11th April 2018 @ 11:02 PM
    Join Date
    18 Dec 2012
    Location
    Hujra
    Age
    31
    Gender
    Male
    Posts
    3,986
    Threads
    231
    Thanked
    129

    Default

    Great work

  5. #5
    MarhabaG is offline Member
    Last Online
    11th April 2018 @ 11:02 PM
    Join Date
    18 Dec 2012
    Location
    Hujra
    Age
    31
    Gender
    Male
    Posts
    3,986
    Threads
    231
    Credits
    4
    Thanked
    129

    Default

    Thanks for sharing

  6. #6
    Jamil Afridi's Avatar
    Jamil Afridi is offline Advance Member
    Last Online
    5th June 2020 @ 03:49 PM
    Join Date
    27 Nov 2010
    Location
    Karachi
    Gender
    Male
    Posts
    1,465
    Threads
    40
    Credits
    350
    Thanked
    88

    Default

    I love Pakistan

  7. #7
    Akram ullah's Avatar
    Akram ullah is offline Senior Member+
    Last Online
    4th December 2016 @ 09:29 AM
    Join Date
    12 Oct 2014
    Location
    Bannu KPK
    Age
    25
    Gender
    Male
    Posts
    1,220
    Threads
    143
    Credits
    10
    Thanked
    116

    Default

    Wow u did it

  8. #8
    Fazalking098's Avatar
    Fazalking098 is offline Senior Member
    Last Online
    17th November 2017 @ 02:09 PM
    Join Date
    14 Jan 2015
    Location
    Khuzdar
    Age
    26
    Gender
    Male
    Posts
    1,087
    Threads
    98
    Credits
    560
    Thanked
    53

    Default

    nice for sharing with us
    [SIGPIC][/SIGPIC]

  9. #9
    munir4wish is offline Junior Member
    Last Online
    9th July 2017 @ 03:17 AM
    Join Date
    09 Jul 2011
    Age
    35
    Gender
    Male
    Posts
    10
    Threads
    1
    Credits
    974
    Thanked
    0

    Default

    i am doing a project at school but i am having problems that even my instructor can't help me figure out.

    exercise:
    (HugeInteger class) create a class HugeInteger that uses a 40-element array of digits to store a integer as large as 40 digits. Provide member functions input,output,add,andsubtract

  10. #10
    adnankhan32's Avatar
    adnankhan32 is offline Senior Member+
    Last Online
    5th April 2021 @ 02:40 PM
    Join Date
    07 Sep 2014
    Location
    MINGORA
    Age
    27
    Gender
    Male
    Posts
    313
    Threads
    42
    Credits
    129
    Thanked
    12

    Default

    Lekin is programme run kese karna hai?

  11. #11
    GujratMardan's Avatar
    GujratMardan is offline Advance Member
    Last Online
    29th May 2022 @ 07:28 AM
    Join Date
    26 Jun 2011
    Location
    Mardan
    Age
    35
    Gender
    Male
    Posts
    965
    Threads
    6
    Credits
    462
    Thanked
    59

    Default

    Bohat ala sharing. bro
    jazakALLAH

  12. #12
    shoaibyazdan's Avatar
    shoaibyazdan is offline Senior Member
    Last Online
    4th November 2017 @ 06:12 AM
    Join Date
    16 May 2015
    Location
    Sahiwal
    Age
    28
    Gender
    Male
    Posts
    853
    Threads
    48
    Credits
    1,378
    Thanked
    24

    Default

    Allaw

Page 1 of 2 12 LastLast

Similar Threads

  1. Banking management system
    By AlOnEbOy in forum General Discussion
    Replies: 10
    Last Post: 24th August 2012, 01:25 AM
  2. Replies: 42
    Last Post: 1st December 2011, 12:21 PM
  3. Medical Store Retail sale software
    By jaan g in forum Ask an Expert
    Replies: 4
    Last Post: 16th July 2009, 12:09 AM
  4. Customize Multiboot Startup Options in Windows :
    By wahidawan in forum General Discussion
    Replies: 1
    Last Post: 25th November 2008, 07:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •