Advertisement
Guest User

blackmagia

a guest
Nov 29th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <conio.h>
  4. #include <windows.h>
  5. #include <cstdlib>
  6.  
  7. using namespace std;
  8. int tab[3][3];
  9. int main()
  10. {
  11.  
  12. cout<<"TWORZENIE TABLICY"<<endl<<endl;
  13. int losowa;
  14. srand (time(NULL));
  15.  
  16.  
  17.  
  18. for (int y=0; y<3; y++)
  19. {
  20. for (int i=0; i<3; i++)
  21. {
  22. losowa=rand()%80+10;
  23. tab[y][i]=losowa;
  24. cout<<tab[y][i]<<" ";
  25. }
  26. cout<<endl;
  27. }
  28. cout<<endl;
  29. cout<<endl;
  30.  
  31.  
  32. cout<<"WYPISYWANIE PRZEKATNYCH"<<endl<<endl;
  33. for (int q=0; q<3; q++)
  34. {
  35. cout<<tab[q][q]<<" ";
  36. }
  37. int e=0;
  38. cout<<endl;
  39. for (int w=2; w>=0; w--)
  40. {
  41. cout<<tab[w][e]<<" ";
  42. e++;
  43. }
  44. cout<<endl;
  45. cout<<endl;
  46. cout<<endl;
  47.  
  48. cout<<"WYSWIETLANIE LICZB O INDEKSACH PARZSYTYCH"<<endl<<endl;
  49. for(int t=0; t<3; t++)
  50. {
  51. for(int r=0; r<3; r=r+2)
  52. {
  53. cout<<tab[t][r]<<" ";
  54. }
  55. }
  56. cout<<endl;
  57. cout<<endl;
  58. cout<<endl;
  59.  
  60. cout<<"WYSWIETLANIE LICZB O INDEKSACH NIEPARZSYTYCH"<<endl<<endl;
  61. for(int t=0; t<3; t++)
  62. {
  63. for(int r=1; r<3; r=r+2)
  64. {
  65. cout<<tab[t][r]<<" ";
  66. }
  67. }
  68. cout<<endl;
  69. cout<<endl;
  70. cout<<endl;
  71.  
  72. cout<<"LICZBY WIEKSZE OD 50"<<endl<<endl;
  73.  
  74. int a;
  75. int o=0;
  76. int p=0;
  77. for (int y=0; y<3; y++)
  78. {
  79. for (int i=0; i<3; i++)
  80. {
  81. if(tab[y][i]>50)
  82. {
  83. o++;
  84. }
  85. }
  86. }
  87. int ntab[o];
  88. for (int y=0; y<3; y++)
  89. {
  90. for (int i=0; i<3; i++)
  91. {
  92. if(tab[y][i]>50)
  93. {
  94. for(int n=0; n<1; n++)
  95. {
  96. p++;
  97. ntab[p]=tab[y][i];
  98. cout<<ntab[p]<<" ";
  99. }
  100. }
  101. }
  102. }
  103. cout<<endl;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement