Advertisement
kamillo111

działa w chuuuuj !

Nov 26th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int *f(int a){
  6. if(a > 0){
  7. int *tab;
  8. int c;
  9. tab = new int[a];
  10. for (int i = 0; i < a; i++){
  11. cout << "Podaj wartosc tablicy nr: " << i + 1 << endl;
  12. cin >> c;
  13. tab[i] = c;
  14. cout << tab[i] << " " << endl;
  15. }
  16. return tab;
  17. }
  18. else{
  19. cout << " Blad ! Podales liczbe ujemna !";
  20.  
  21. }
  22.  
  23. }
  24. int f(int a, int b){
  25. int tab[20][20];
  26. for(int i = 0; i < a; i++){
  27. for(int j = 0; j < b; j++){
  28. tab[i][j];
  29. cout << tab[i][j] << " ";
  30. }
  31. }
  32.  
  33. }
  34.  
  35. int main(){
  36. int b;
  37. int a;
  38. cout << "Podaj ilu elementowa ma byc tablica(Liczba dodatnia): ";
  39. cin >> b;
  40. cout << f(b);
  41. cout << "Jesli chcesz dopisac drugi wymiar wpisz liczbe dodatnia o 2 wym:";
  42. cin >> a;
  43. cout << f(b,a);
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement