Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void zad1()
- {
- int i=1;
- int tab[6][6];
- for(int a=0; a<6; a++)
- {
- for(int g= 0; g<6; g++)
- {
- tab[a][g]=i;
- i++;
- cout <<tab[a][g]<<" ";
- }
- cout <<endl;
- }
- }
- void zad2()
- {
- int i=0;
- int tab[6][6];
- for(int a=0; a<6; a++)
- {
- for(int g= 0; g<6; g++)
- {
- tab[a][g]=i;
- cout.width(2);
- cout <<tab[a][g]<<" ";
- }
- cout <<endl;
- }
- }
- void zad3()
- {
- int tab[6][6];
- for(int j=0; j<6;j++)
- {
- for(int g=0; g<6; g++)
- {
- if (j==g)
- {
- tab[j][g]=1;
- }
- else
- {
- tab[j][g]=0;
- }
- cout <<tab[j][g]<<" ";
- }
- cout <<endl;
- }
- }
- void zad4 ()
- {
- int tab[6][6];
- for (int f=0;f<6;f++)
- {
- for(int g=0;g<6;g++)
- {
- if(f>=g)
- tab[f][g]=1;
- else
- {
- tab[f][g]=0;
- }
- cout<<tab[f][g]<<" ";
- }
- cout << endl;
- }
- }
- void zad5 ()
- {
- int x=6;
- int tab[x][x];
- for (int f=0;f<x;f++)
- {
- for(int g=0;g<x;g++)
- {
- if (g+f==x-1)
- tab[f][g]=1;
- else
- tab[f][g]=0;
- cout << tab[f][g]<<" ";
- }
- cout << endl;
- }
- }
- void zad6 ()
- {
- int tab[6][6];
- for (int f=0;f<6;f++)
- {
- for(int g=0;g<6;g++)
- {
- if(f+g>=6-1)
- tab[f][g]=1;
- else
- tab[f][g]=0;
- cout<<tab[f][g]<<" ";
- }
- cout << endl;
- }
- }
- void zad7()
- {
- int i=0;
- int tab[6][6];
- {
- for(int g=0;g<6;g++)
- {
- for(int j=0;j<6;j++)
- {
- tab[j][g]=i;
- i++;
- }
- }
- for(int g=0;g<6;g++)
- {
- for(int j=0;j<6;j++)
- {
- cout <<tab[j][g]<<" ";
- }
- cout <<endl;
- }
- }
- }
- void zad8 ()
- {
- int i=1;
- int x=6;
- int tab[x][x];
- for(int g=0;g<x;g++)
- {
- if (g%2==0)
- {
- for(int f=0;f<x;f++)
- {
- tab [g][f]=i;
- i++;
- }
- }
- else
- {
- for(int f=x-1;f>=0;f--)
- {
- tab [g][f]=i;
- i++;
- }
- }
- }
- for(int g=0;g<x;g++)
- {
- for(int f=0;f<x;f++)
- {
- cout << tab[g][f] << " ";
- }
- cout << endl;
- }
- }
- int main()
- {
- zad1();
- cout <<endl;
- zad2();
- cout <<endl;
- zad3();
- cout <<endl;
- zad4();
- cout <<endl;
- zad5();
- cout <<endl;
- zad6();
- cout <<endl;
- zad7();
- cout <<endl;
- zad8();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement