Advertisement
Guest User

Static

a guest
May 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include<iostream>
  2. #include<string.h>
  3. using namespace std;
  4. class Produkt{
  5. private:
  6.     int cena;
  7.     char ime[20];
  8. public:
  9.    static int popust;
  10.    static int ID;
  11.     Produkt(int cena1=0,char *ime1=""){
  12.      cena=cena1;
  13.      strcpy(ime,ime1);
  14.      ID++;
  15.     }
  16.     ~Produkt(){
  17.      ID--;
  18.     }
  19.     void pecati(){
  20.     cout<<ime<<" "<<cena<<endl;
  21.     }
  22.    static void setPopust(int popust1){
  23.      popust=popust1;
  24.     }
  25.     float getCena(){
  26.      return cena-cena*popust/100.0;
  27.     }
  28.     int getID(){
  29.     return ID;
  30.     }
  31.     static int presmetka(int broj,int broj2){
  32.     return broj2-broj;
  33.     }
  34.  
  35. };
  36. int presmetka(int broj,int broj2){
  37.     return broj2-broj;
  38.     }
  39. int Produkt::popust=5;
  40. int Produkt::ID=0;
  41. int main(){
  42.  cout<<Produkt::presmetka(3,10);
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement