Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Apteka {
- string lokacija;
- int br_vraboteni;
- float prosecen_dneven_promet;
- void init(string _lokacija, int _br_vraboteni, float _prosecen_dneven_promet) {
- lokacija = _lokacija;
- br_vraboteni = _br_vraboteni;
- prosecen_dneven_promet = _prosecen_dneven_promet;
- }
- void pechati() {
- cout << "Lokacija: " << lokacija << endl;
- cout << "Broj na vraboteni: " << br_vraboteni << endl;
- cout << "Dneven promet: " << prosecen_dneven_promet << endl;
- }
- };
- struct Lanec {
- string ime;
- int br_apteki;
- Apteka niza[4];
- void init(string _ime, int _br_apteki, Apteka _niza[4]) {
- ime = _ime;
- br_apteki = _br_apteki;
- for(int i = 0; i < br_apteki; i++) {
- niza[i] = _niza[i];
- }
- }
- void pechati() {
- cout << "Ime na lanec: " << ime << endl;
- cout << br_apteki << endl;
- for(int i = 0; i < br_apteki; i++) {
- niza[i].pechati();
- }
- }
- void pechati(float x) {
- cout << "Apteki so pogolem dneven promet od " << x << ": " << endl;
- for(int i = 0; i < br_apteki; i++) {
- if(niza[i].prosecen_dneven_promet > x) {
- niza[i].pechati();
- }
- }
- }
- };
- int main() {
- Apteka apteki[2];
- apteki[0].init("Karposh", 3, 150000.12);
- apteki[1].init("Kumanovo", 10, 4000.12);
- Lanec lanci[2];
- lanci[0].init("Zegin", 2, apteki);
- Apteka apteki2[3];
- apteki2[0].init("Ohrid", 5, 100000.9);
- apteki2[1].init("Struga", 3, 1400.0);
- apteki2[2].init("Gostivar", 5, 50000);
- lanci[1].init("Eurofarm", 3, apteki2);
- lanci[0].pechati(100000);
- lanci[1].pechati(100000);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement