Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5. /* run this program using the console pauser or add your own getch, system("pause") or input loop*/
  6. class Macierz{
  7. int wektor[100];
  8. int macierz[5][5];
  9. public:
  10. Macierz(){
  11. for(int a=0;a<100;a++)
  12. wektor[a]=a+1;
  13. for(int z=0;z<5;z++)
  14. {for(int x=0;x<5;x++)
  15. macierz[z][x]=1;
  16. }
  17. }
  18. void wypiszw(){
  19. for(int a=0;a<100;a++)
  20. cout<<wektor[a]<<" ";}
  21. void wypiszm(){
  22. for(int z=0;z<5;z++)
  23. {cout<<endl;
  24. for(int x=0;x<5;x++)
  25. cout<<macierz[z][x]<<" ";}
  26. }
  27. void zmiana(int i, int j, int k){
  28. cout<<endl<<"Podaj wiersz i kolumne"<<endl;
  29. cin>>i>>j;
  30. cout<<endl<<"Na jaka liczbe chcesz zmienic?"<<endl;
  31. cin>>k;
  32. macierz[i][j]=k;
  33. }
  34. };
  35.  
  36. int main(int argc, char** argv) {
  37.  
  38. Macierz q;
  39. q.wypiszw();
  40. q.wypiszm();
  41. q.zmiana(1,1,5);
  42. q.wypiszm();
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement