Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<string.h>
- using namespace std;
- class Vraboten
- {
- private:
- char ime [30];
- float plata;
- int rabp;
- public:
- Vraboten()
- {
- ime[0]='\0';
- plata=0.0;
- rabp=0;
- }
- ~Vraboten(){}
- void setime(char *i)
- {
- strncpy(ime,i,29);
- ime[29]='\0';
- }
- char *getime()
- {
- return ime;
- }
- bool setplata(float p)
- {
- if(p>=0)
- {
- plata=p;
- return true;
- }
- else
- {
- plata=0.0;
- return false;
- }
- }
- void setrabp(int rp)
- {
- if(rp==0||rp==1||rp==2)
- {
- rabp=rp;
- }
- else
- {
- cout<<"Greska"<<endl;
- }
- }
- float getplata()
- {
- return plata;
- }
- int getrabp()
- {
- return rabp;
- }
- };
- int main()
- {
- Vraboten LV[100],pom;
- int N;
- cout<<"Vnesete kolku vraboteni ke ima";
- cin>>N;
- for(int i=0;i<N;i++)
- {
- char ime[30];
- float plata;
- int rabp;
- cout<<"Vnesete gi podatocite za vrabotenite"<<endl;
- cin>>ime>>plata>>rabp;
- LV[i].setime(ime);
- LV[i].setplata(plata);
- LV[i].setrabp(rabp);
- }
- for(int i=0;i<N;i++)
- {
- for(int j=i+1;j<N;j++)
- {
- if(LV[i].getplata()<LV[j].getplata())
- {
- pom=LV[i];
- LV[i]=LV[j];
- LV[j]=pom;
- }
- }
- }
- for(int i=0;i<N;i++)
- {
- cout<<LV[i].getime();
- }
- return 0;
- }
- Za vraboteni, pecati po redosled koj ima najvisoka plata
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement