Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <conio.h>
- #include <windows.h>
- #include <cstdlib>
- using namespace std;
- int tab[3][3];
- int main()
- {
- cout<<"TWORZENIE TABLICY"<<endl<<endl;
- int losowa;
- srand (time(NULL));
- for (int y=0; y<3; y++)
- {
- for (int i=0; i<3; i++)
- {
- losowa=rand()%80+10;
- tab[y][i]=losowa;
- cout<<tab[y][i]<<" ";
- }
- cout<<endl;
- }
- cout<<endl;
- cout<<endl;
- cout<<"WYPISYWANIE PRZEKATNYCH"<<endl<<endl;
- for (int q=0; q<3; q++)
- {
- cout<<tab[q][q]<<" ";
- }
- int e=0;
- cout<<endl;
- for (int w=2; w>=0; w--)
- {
- cout<<tab[w][e]<<" ";
- e++;
- }
- cout<<endl;
- cout<<endl;
- cout<<endl;
- cout<<"WYSWIETLANIE LICZB O INDEKSACH PARZSYTYCH"<<endl<<endl;
- for(int t=0; t<3; t++)
- {
- for(int r=0; r<3; r=r+2)
- {
- cout<<tab[t][r]<<" ";
- }
- }
- cout<<endl;
- cout<<endl;
- cout<<endl;
- cout<<"WYSWIETLANIE LICZB O INDEKSACH NIEPARZSYTYCH"<<endl<<endl;
- for(int t=0; t<3; t++)
- {
- for(int r=1; r<3; r=r+2)
- {
- cout<<tab[t][r]<<" ";
- }
- }
- cout<<endl;
- cout<<endl;
- cout<<endl;
- cout<<"LICZBY WIEKSZE OD 50"<<endl<<endl;
- int a;
- int o=0;
- int p=0;
- for (int y=0; y<3; y++)
- {
- for (int i=0; i<3; i++)
- {
- if(tab[y][i]>50)
- {
- o++;
- }
- }
- }
- int ntab[o];
- for (int y=0; y<3; y++)
- {
- for (int i=0; i<3; i++)
- {
- if(tab[y][i]>50)
- {
- for(int n=0; n<1; n++)
- {
- p++;
- ntab[p]=tab[y][i];
- cout<<ntab[p]<<" ";
- }
- }
- }
- }
- cout<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement