All pastes #797146 Raw Edit

Something

public cpp v1 · immutable
#797146 ·published 2007-11-25 20:06 UTC
rendered paste body
#include <cstdlib>#include <iostream>using namespace std;class dane {      	public:      	float tablica[10];      	unsigned int uZm1;      	unsigned int uZm2;            	dane(unsigned int a = 0, unsigned int b = 0) : uZm1(a), uZm2(b){      	for(int i=0; i<10; i++)      	tablica[i]=3;      	}                      	dane operator++(int);            // przyrostkowy      	dane operator--();               // przedrostkowy      	float operator[](unsigned int komorka);	void operator()(unsigned int a, unsigned int b, unsigned int c, float d);                 	};float dane:: operator[](unsigned int komorka){      float temp;      if(komorka<10){      temp = this->tablica[komorka];      return temp;      } else      return 0;      }      dane dane :: operator++(int){       uZm1 = uZm1+1;       uZm2 = uZm2+1;       for(int i=0; i<10; i++)       tablica[i]=tablica[i]+1;       return *this;       }       ostream& operator<<(ostream& ekran, dane& A){      // przeladowany operator <<         ekran<<"uZm1= "<<A.uZm1<<endl;         ekran<<"uZm2= "<<A.uZm2<<endl;	cout<<"A tablica wyglada tak:"<<endl;         for(int i=0; i<10; i++)         ekran<<i<<". "<<A.tablica[i]<<endl;          return ekran;         }         dane dane :: operator--(){       uZm1 = uZm1-1;       uZm2 = uZm2-1;       for(int i=0; i<10; i++)       tablica[i]=tablica[i]-1;       return *this;       }void dane :: operator()(unsigned int a, unsigned int b, unsigned int c, float d){uZm1 = a;uZm2 = b;if (c<10)tablica[c]=d;}              int main(int argc, char *argv[]){    dane A, B, C, D;    A++;    cout<<A;    --B;    cout<<B;        float fLiczba = C[3];    cout<<fLiczba<<endl;	D(9,8,3,0);	cout<<D;            return EXIT_SUCCESS;}