help me guys please.. its urgent

Pages: 12
create a software using object oriented programming for a dentist that maintains data for his patients along with their history.
application should be capable of storing, modifying and displaying data. provide a menu driven solution.
plz frndz i need this code urgntly
hmm.....
How much do you pay?
Excuse me!! nothing..
hmm.... that's not much.
When is it due?
monday... :(
1
2
3
4
5
6
7
8
9
#include<iostream>

using namespace std;

int main()
{
    cout<<"LoL"<<endl;
    return 0;
}
seriously need help.
Then try it yourself and post what you need help with when you have problems with your program.
No one is going to do your homework for you.
i tried it by my self but i have some problems i dont know how to add parameterized constructor and em olredy having error in header file
here is the code
class patient
{

private:
int p_id;
char name(20);
int age;
char adress(50);
int phone_no;
char history(100);
char last_appointment(20);
char next_appointment(20);
public:
patient();

void get_data();
void display_data();
void modify_data();

};
#include<stdio,h>
#include<conio.h>
#include<string.h>
#include<windows.h>
using namespace std
#include"patient.h"

void patient.patient()
{
p_id=0;

}

void patient::get_data()
int n;
cout<<"enter the number of the patients"<<endl;
cin>>n;
patient p[10];
for(int i=0; i<n; i++)
{
cout<<"\nEnter Patient ID=\n";
cin>>p_id;
cout<<"Enter Name of Patient=";
cin>>p[i].name;
cout<<"\nEnter Age of Patient=\n";
cin>>p[i].age;
cout<<"\nEnter Address of Patient";
cin>>[pi]adress;
cout<<"\nEnter Contect No.=\n";
cin>>p[i].phone_no;
cout<<"Enter History of Patient=";
cin>>p[i].history;
cout<<"Enter Last visit of Patient=";
cin>>p[i].last_appointment;

cout<<"Enter Next visit date of Patient=";
cin>>p[i].next_appointment;
}


void patient::display_data()
{
cout <<"\n\n;
cout << "\t\t====== PATIENT INFORMATION SYSTEM ======";
cout << "\n\n";
cout<<"\nPatient Name="<<p[i].name<<endl;
cout<<"\nPatient ID="<<p[i].p_id;
cout<<"\nPatient Address="<<p[i].adress;
cout<<"\nContect Number="<<p[i].phone_no;
cout<<"\nPatient Medical History="<<p[i].history;
cout<<"\nLast visit of Patient="<<p[i].last_appointment;
cout<<"\nNext Appointment="<<p[i].next_appointment;
cout<<"\t\t=========End================";
}

void patient::modify_data()
{
cout<<"\nEnter Patient ID=\n";
cin>>p_id;
cout<<"Enter Name of Patient=";
cin>>name;
cout<<"\nEnter Age of Patient=\n";
cin>>age;
cout<<"\nEnter Address of Patient";
cin>>adress;
cout<<"\nEnter Contect No.=\n";
cin>>phone_no;
cout<<"Enter History of Patient=";
cin>>history;
cout<<"Enter Last visit of Patient=";
cin>>last_appointment;

cout<<"Enter Next visit date of Patient=";
cin>>next_appointment;
}
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<windows.h>
using namespace std
#include"patient.h"
void main()
{
patient p1, p2;
do
{
system("cls");
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t01. Get_Data";
cout<<"\n\n\t02. Display_Data";
cout<<"\n\n\t03. Modify Data";
cout<<"\n\n\tPlease Select Your Option (1-3) ";
cin>>ch;
switch(ch)

{
case '1': get_data();
break;
case '2': display_data();
break;
case '3': modify_data();
case '4':
break;

default :cout<<"\a";
}
}while(ch!='4');
return 0;
}
}
frndx kindly help
Here's something roughly similar that I made a little over a year ago, hope it helps. It's a phonebook and there is plenty of crap and/or useless code in here, but it may give you some ideas.

Person.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef PERSON_H
#define PERSON_H
#include <string>
#include <iostream>

class Person
{
public:
    Person(std::string name, std::string last, std::string number);

    void PrintInfo();

    std::string GetFirstName();
    std::string GetLastName();
    std::string GetNumber();

private:
    std::string firstName;
    std::string lastName;
    std::string phone;
};

#endif // PERSON_H  


Person.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "Person.h"
//#include <iostream>// included in Person.h

Person::Person(std::string name, std::string last, std::string number):
firstName(name), lastName(last), phone(number){}

void Person::PrintInfo()
{
    std::cout << firstName << " " << lastName << " #" << phone << std::endl;
}

std::string Person::GetFirstName()
{
    return firstName;
}

std::string Person::GetLastName()
{
    return lastName;
}

std::string Person::GetNumber()
{
    return phone;
}



Phonebook.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef PHONEBOOK_H
#define PHONEBOOK_H
#include <list>
//#include <string> // included in Person.h
#include "Person.h"


class PhoneBook
{
public:

    void AddInfo(Person&);
    void RemoveInfo(int);
    void PrintInfo(int);
    int FindInfo(std::string);
    void SwapInfo(int, int);
    int GetSize();
    std::_List_iterator<Person> GetFirstPerson(); //I could either return iterator or dereferenced iterator, but I'll just use -> to access the objects function
    std::_List_iterator<Person> GetLastPerson();
    std::_List_iterator<Person> GetPerson(int);

private:
    std::list<Person> info;
    std::list<Person>::iterator itr1, itr2; //2 iterators are needed for swaping, or at least it makes it easier
};

#endif // PHONEBOOK_H  
Last edited on

Phonebook.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include "PhoneBook.h"
//#include <iostream> // included in Person.h

void PhoneBook::AddInfo(Person &person)
{
    info.push_back(person);
}

void PhoneBook::RemoveInfo(int index)
{
    if ((unsigned int)index > info.size() || index < 0) //unsigning the int removes the warning, not sure if it would be better to leave the warning as it was
    {
        std::cout << "[ERROR] That request is out of range" << std::endl;
        return;
    }

    itr1 = info.begin();
    std::advance(itr1, index);
    info.erase(itr1);
}

void PhoneBook::PrintInfo(int index)
{
    std::cout << std::endl;

    if ((unsigned int)index > info.size() && index >= 0)
    {
        std::cout << "[ERROR] That request is out of range." << std::endl;
        return;
    }

    itr1 = info.begin();

    if (index < 0)
    {
        std::cout << "Printing all known contacts." << std::endl;
        for(unsigned int c = 0; c < info.size(); c++) // the index number, something that Person.cpp can't provide
        {
            std::cout << "[" << c << "] ";
            itr1->PrintInfo(); //the objects PrintInfo() function
            itr1++;
        }
        std::cout << "No more known contacts." << std::endl;
    }
    else
    {
        std::advance(itr1, index);
        std::cout << "[" << index << "] ";
        itr1->PrintInfo();
    }

    std::cout << std::endl;
}

int PhoneBook::FindInfo(std::string search)
{
    itr1 = info.begin();
    for(unsigned int index = 0; index < info.size(); index++)
    {
        if (itr1->GetFirstName() == search || itr1->GetLastName() == search || itr1->GetNumber() == search) //quite a specific search, not partial
        {
            std::cout << "Person Found: [" << index << "] ";
            itr1->PrintInfo();
            return index; //useful if I want to call this function inside a function which needs an index
        }
        else itr1++;
    }

    std::cout << "No Matches Found." << std::endl;
    return -1;
}

void PhoneBook::SwapInfo(int index1, int index2)
{
    if ((unsigned int)index1 > info.size() || (unsigned int)index2 > info.size() || index1 < 0 || index2 < 0)
    {
        std::cout << "[ERROR] That request is out of range." << std::endl;
        return;
    }

    itr1 = info.begin();
    itr2 = info.begin();

    std::advance(itr1, index1); // itr1 = person one
    std::advance(itr2, index2); // itr2 = person two

    info.insert(itr2, *itr1); // copy person one to the slot below person two
    info.insert(itr1, *itr2);

    this->RemoveInfo(index2 + 2); // 2 elements inserted, so aim 2 elements higher
    this->RemoveInfo(index1 + 1); // remove original person 2 which is currently above person 1

    std::cout << "[" << index1 << "] " << itr1->GetFirstName() << " " << itr1->GetLastName() << " has been swaped with [" << index2 << "] " << itr2->GetFirstName() << " " << itr2->GetLastName() << std::endl;
}

int PhoneBook::GetSize()
{
    return info.size();
}

std::_List_iterator<Person> PhoneBook::GetFirstPerson()
{
    return info.begin();
}

std::_List_iterator<Person> PhoneBook::GetLastPerson()
{
    itr1 = info.end();
    itr1--;
    return itr1;
}

std::_List_iterator<Person> PhoneBook::GetPerson(int index)
{
    itr1 = info.begin();
    advance (itr1, index);
    return itr1;
}


main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
//#include <iostream> // included in Person.h
//#include <list> // included in PhoneBook.h
//#include "Person.h" // included in PhoneBook.h
#include "PhoneBook.h"
#include <vector>
#include <cstdlib> // atoi
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1

void Display();
void Print(std::string);
void Clignore();
void AddContact();
void RemoveContact();
void SortContacts();
void FindContact();
void ContactInfo();

PhoneBook PhoneBook;

std::vector<Person*> PtrPerson;

int main()
{
    Print("");
    Print("Intro Text...");
    Display();
    bool exitloop = false;

    while (!exitloop)
    {
        int menuChoice;

        Print("[1] Add Contact");
        Print("[2] Remove Contact");
        Print("[3] Sort Contacts");
        Print("[4] Find Contact");
        Print("[5] Indv. Contact Info\n");

        std::cin >> menuChoice;
        Clignore();

        switch (menuChoice)
        {
        case 1:
            AddContact();
            break;
        case 2:
            RemoveContact();
            break;
        case 3:
            SortContacts();
            break;
        case 4:
            FindContact();
            break;
        case 5:
            ContactInfo();
            break;
        default:
            Print("Not a valid option, try again.");
        };
    }

    return EXIT_SUCCESS;
}

void Display()
{
    PhoneBook.PrintInfo(-1);
}

void Print(std::string text)
{
    std::cout << text << std::endl;
}

void Clignore() // clean and ignore.. I'm sure there's a word for combining two words
{
    std::cin.clear();
    std::cin.ignore();
}

void AddContact()
{
    std::string first;
    std::string last;
    std::string num;
    Display();

    while(true)
    {
        Print("Enter all three details (first name, last name, phone number) seperated by a space in that order");
        Print("");
        std::cin >> first >> last >> num;
        Clignore();
        Person* ptr1 = new Person(first, last, num);
        PtrPerson.push_back(ptr1);
        Print(first);
        Print(last);
        Print(num);
        PhoneBook.AddInfo(*ptr1);
        PhoneBook.PrintInfo(-1);

        //std::cout << "There are now " << PhoneBook.GetSize() << " people in your PhoneBook" << std::endl;
        Print("Would you like to add another person?");
        Print("");
        std::cin >> first; // saves a variable I suppose
        Clignore();

        if (first == "n" || first == "N" || first == "no" || first == "No" || first == "NO")
        {
            Print("");
            return;
        }

        Print("");
    }
}

void RemoveContact()
{
    if (PhoneBook.GetSize() == 0)
    {
        Print("");
        Print("No contacts to remove");
        Print("");
        return;
    }

    std::string answer;
    Display();
    Print("Would you like to remove a contact by index number, or by finding them?");
    Print("");
    Print("[1] By Index");
    Print("[2] By Finding");
    Print("");

    std::cin >> answer;
    Clignore();

    if (answer == "1")
    {
        while (true)
        {
            if (PhoneBook.GetSize() == 0)
            {
                Print("");
                Print("No contacts to remove");
                Print("");
                return;
            }

            Display();
            Print("Enter the index");
            Print("");
            int index;
            std::cin >> index;
            Clignore();
            Person temp = *PhoneBook.GetPerson(index);

            Print("");
            std::cout << temp.GetFirstName() << " " << temp.GetLastName() << " has been removed" << std::endl;

            delete PtrPerson[index];
            PtrPerson.erase (PtrPerson.begin() + index);

            PhoneBook.RemoveInfo(index);
            Print("");

            if (PhoneBook.GetSize() == 0)
            {
                Print("No more contacts to remove");
                Print("");
                return;
            }
            else if (PhoneBook.GetSize() != 0)
            {
                Print("Would you like to remove another contact?");
                Print("");

                std::cin >> answer;
                Clignore();

                if (answer == "n" || answer == "N" || answer == "no" || answer == "No" || answer == "NO")
                {
                    Print("");
                    return;
                }
            }
        }

    }
    else if (answer == "2")
    {
        Print("Not yet...");
    }
}

void SortContacts()
{
    Print("can't do this until I can also sort the pointers to the objects, otherwise I wouldn't know which pointer to remove");
}

void FindContact()
{
    Print("Not yet...");
}

void ContactInfo()
{
    Print("Not yet...");
}
thanks...
He just gave you an excessively large program that doesn't work and you thanked him for it.
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

     int main()
     {
          cout << "Hello World!" << endl;
     }
Last edited on
4: Warning: improper indentation, is this really what you meant?
4: Error: undeclared identifier 'cout'
4: Error: undeclared identifier 'endl'
OKay "L B" since you were worried about my joke "Hello World" program not working I fixed it for you!
no i thanked cox i got the idea what i have to do xactly..
Pages: 12