Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- struct id {
- char ime[10];
- char prezime[20];
- };
- struct radnik {
- int ib;
- id imeiprezime;
- double dohodak;
- int staz;
- char spol[6];
- };
- void unos(radnik *p, int x)
- {
- for (int i = 0;i < x;i++)
- {
- cout << "Unesi ime i prezime: ";
- cin >> p[i].imeiprezime.ime>>p[i].imeiprezime.prezime;
- cout << "\nUnesi spol: ";
- cin >> p[i].spol;
- cout << "\nUnesi ib: ";
- cin >> p[i].ib;
- cout << "\nUnesi dohodak: ";
- cin >> p[i].dohodak;
- cout << "Unesi staz: ";
- cin >> p[i].staz;
- }
- }
- void ispis(radnik *p)
- {
- cout << "Ime i prezime: " << p->imeiprezime.ime <<" "<< p->imeiprezime.prezime<<endl;
- cout << "Spol: " << p->spol<<endl;
- cout << "ib: " << p->ib<<endl;
- cout << "Dohodak: " << p->dohodak << endl;
- cout << "Staz: " << p->staz<<endl;
- }
- int prebroji_zene(radnik *p, int x)
- {
- int brojac = 0;
- for (int i = 0;i < x;i++)
- {
- if (p[i].spol[0] == 'z' || p[i].spol[0] == 'Z')
- brojac++;
- }
- return brojac;
- }
- void kopiraj_zene(radnik *p, radnik *z, int x)
- {
- int j = 0;
- for (int i = 0;i < x;i++)
- {
- if (p[i].spol[0] == 'z' || p[i].spol[0] == 'Z')
- {
- z[j] = p[i];
- j++;
- }
- }
- }
- radnik *najduze_prezime(radnik *p, int x)
- {
- int najduze_p=0;
- radnik *pok = p;
- string prez;
- for (int i = 0;i < x;i++)
- {
- prez = p[i].imeiprezime.prezime;
- if (najduze_p < prez.length())
- {
- najduze_p = prez.length();
- pok = &p[i];
- }
- }
- return pok;
- }
- double prihod(radnik *p,int x,int nesta)
- {
- double suma=0;
- for (int i = 0;i < x;i++)
- {
- if (i == nesta)
- {
- suma = (p[i].dohodak + p[i].dohodak*0.06) * 12;
- }
- }
- return suma;
- }
- void pretraga_po_imenu(radnik *p, char *covjek, int x)
- {
- for (int i = 0;i < x;i++)
- {
- if (covjek == p[i].imeiprezime.ime)
- {
- ispis(p);
- }
- }
- }
- int main()
- {
- radnik *p;
- radnik *zenski_niz;
- int broj_ljudi;
- p = new radnik[broj_ljudi];
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement