Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <ctime>
- #include <cstdlib>
- #include <iomanip>
- using namespace std;
- struct Lekarz {
- string imie, nazwisko, specjalizacja;
- int dzien, godzina;
- Lekarz *nastepna;
- };
- struct lista {
- Lekarz *pierwsza;
- void dodaj_osobe(string imie, string nazwisko, string specjalizacja, int dzien, int godzina);
- };
- void lista::dodaj_osobe(string imie, string nazwisko, string specjalizacja, int dzien, int godzina)
- {
- Lekarz *nowa = new Lekarz;
- nowa->imie = imie;
- nowa->nazwisko = nazwisko;
- nowa->specjalizacja = specjalizacja;
- nowa->dzien = dzien;
- nowa->godzina = godzina;
- if (pierwsza==0)
- {
- pierwsza = nowa;
- }
- else
- {
- Lekarz *temp = pierwsza;
- while (temp->nastepna)
- {
- temp = temp->nastepna;
- }
- temp->nastepna = nowa;
- nowa->nastepna = 0;
- }
- }
- Lekarz *WyszukajSpecjalizacje()
- {
- Lekarz *nowa = new Lekarz;
- cout << endl << "Prosze wybrac odpowiednia specjalizacje (Pelna nazwa): " << endl;
- string Specjalizacja;
- getline(cin, Specjalizacja);
- while(nowa!=NULL)
- {
- if(nowa->specjalizacja==Specjalizacja)
- cout << nowa->imie << endl;
- nowa=nowa->nastepna;
- }
- }
- int main()
- {
- lista *baza = new lista;
- baza->dodaj_osobe("Jan","Kowalski","Internista",1,1);
- cout << "Witaj w systemie rejestracji pacjentow \n"
- "Wybierz interesujaca cie specjalizacje: \n " << endl;
- ifstream specjalizacje;
- string linijka;
- specjalizacje.open("../Projekt_Zaliczeniowy//Specjalizacje.txt");
- if(specjalizacje.good())
- {
- do
- {
- getline(specjalizacje, linijka);
- cout<<linijka<<endl;
- }
- while(!specjalizacje.eof());
- }
- specjalizacje.close();
- WyszukajSpecjalizacje();
- delete (baza);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement