Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //
- //void rekurencja(char* tab, int indeks) //funkcja void bo nie zwraca niczego, tylko drukuje
- //{
- // cout<< tab[indeks]<<endl; //wyswietlamy znak
- // if(indeks>0) rekurencja(tab,indeks-1); // funkkcja wywołuje samą siebie,, tylko z indeksem o jeden mniejszym
- //
- //
- //}
- //int main()
- //{
- //
- // char tab[] = "ZNAKI"; //tworzymy tablice
- // rekurencja(tab, 4); //wywolujemy funkcje rekurencja
- //}
- //referencje
- //
- //int main() {
- // int k = 5;
- // int &refk = k;
- //
- // cout << "refk = " << refk << endl;
- // cout << " k = " << k << endl;
- //
- // k = 7;
- //
- // cout << "refk = " << refk << endl;
- // cout << " k = " << k << endl;
- //
- // refk = 9;
- //
- // cout << "refk = " << refk << endl;
- // cout << " k = " << k << endl;
- //}
- //TABLICE
- //int main() {
- // int tab[] = {1, 2, 3, 4, 5};
- //
- // cout<<"Rozmiar: "<<sizeof(*tab)<<endl;
- //
- // for (int i = 0; i < sizeof(*tab)+1; i++){
- // cout<<tab[i]<<endl;
- // }
- //
- // int *wsk = &tab[sizeof(*tab)];
- //
- // cout<<"Wskaznik na ostatni element tablicy: "<<*wsk<<endl;
- //
- // while (*wsk != 0){
- // cout<<*wsk<<endl;
- // wsk--;
- // }
- //}
- //klasy - konstruktory - destruktory
- //class Myclass {
- //public:
- // int abc;
- //
- // Myclass();
- //
- // ~Myclass();
- //};
- //
- //Myclass::Myclass() {
- // cout << "Wywolany konstruktor: " <<abc<< endl;
- //};
- //
- //Myclass::~Myclass() {
- // cout << "Wykonany zostal destruktor" << endl;
- //}
- //
- //int main() {
- // //Myclass myclass;
- // int a;
- // Myclass *myclass = new Myclass();
- // //myclass = new Myclass(3);
- // myclass->abc=8;
- // cout<<myclass->abc<<endl;
- // delete (myclass);
- // cout<<a<<endl;
- // cout<<myclass->abc<<endl;
- //}
- //Metoda
- //void wczytajTablice(int * tab,int size){
- // cout<<"Rozmiar: "<< sizeof(*tab)<<endl;
- // for(int i = 0; i< size ; i++){
- // cout<<tab[i]<<endl;
- // }
- //}
- //
- //int main(){
- // int tab[] ={8,5,4,3,2,1,1,35,5,6};
- // cout<<"Rozmiar: "<< sizeof(*tab)<<endl;
- // wczytajTablice(tab,10);
- //}
- //class Test {
- //private:
- // int rozmiar;
- // string wielkosc;
- //public:
- // Test(int rozmiar, string wielkosc) {
- // this->rozmiar = rozmiar;
- // this->wielkosc = wielkosc;
- // };
- // void pokaRozmiarWielkosc();
- //};
- //
- //void Test ::pokaRozmiarWielkosc() {
- // cout<<"Pa jaki duzy: "<<rozmiar<<endl;
- // cout<<"Pa jaki wielki: "<<wielkosc<<endl;
- //}
- //
- //int main() {
- // Test * test1 = new Test(12, "big");
- // Test * test2 = new Test(30 , "Very big");
- //
- // test1->pokaRozmiarWielkosc();
- // test2->pokaRozmiarWielkosc();
- //}
- //
- class destruktor {
- public:
- int abc;
- ~destruktor();
- };
- destruktor::~destruktor() {
- cout<<"wykonano"<<endl;
- }
- int main() {
- destruktor *destruktor1 = new destruktor();
- destruktor1->abc=1;
- delete destruktor1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement