Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- #include <stack>
- #include <queue>
- #include <map>
- #include <set> //za gomilu
- #include<fstream>
- #include <string>
- using namespace std;
- struct pacijent{
- string ime;
- string prezime;
- int id;
- };
- queue<pacijent> prijava(queue<pacijent> &red){
- cout<<"Unesi ime prezime i id"<<endl;
- pacijent tmp;
- cin>>tmp.ime>>tmp.prezime>>tmp.id;
- red.push(tmp);
- return red;
- }
- void baza_load(queue <pacijent> &red){
- ifstream fin;
- fin.open("baza.txt");
- while(fin){
- pacijent osoba;
- fin>>osoba.ime>>osoba.prezime>>osoba.id;
- red.push(osoba);
- }
- fin.close();
- }
- void baza_out(queue<pacijent> red){
- ofstream fout;
- fout.open("baza.txt");
- for (int i=0;i<red.size();i++){
- fout<<red.front().ime<<endl;
- fout<<red.front().prezime<<endl;
- fout<<red.front().id<<endl;
- }
- fout.close();
- }
- int main()
- {
- queue<pacijent>red;
- baza_load(red);
- cout<<"Dobar dan zelite li se prijaviti, birajte 1, ulazak kod doktora 2, trenutno kod doktora 3?"<<endl;
- int ulaz;
- cin>>ulaz;
- while(ulaz!=0){
- switch(ulaz){
- case 1:
- prijava(red);
- break;
- case 2:
- red.pop();
- cout<<"Molim slijedeceg pacijenta, gdin/gda. "<< red.front().ime <<endl;
- break;
- case 3:
- cout<<"Trenutno je kod ljecnika "<< red.front().ime<<endl;
- break;
- }
- cout<<"Dobar dan zelite li se prijaviti, birajte 1, ulazak kod doktora 2, trenutno kod doktora 3?"<<endl;
- cin>>ulaz;
- }
- baza_out(red);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement