Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int *f(int a){
- if(a > 0){
- int *tab;
- int c;
- tab = new int[a];
- for (int i = 0; i < a; i++){
- cout << "Podaj wartosc tablicy nr: " << i + 1 << endl;
- cin >> c;
- tab[i] = c;
- cout << tab[i] << " " << endl;
- }
- return tab;
- }
- else{
- cout << " Blad ! Podales liczbe ujemna !";
- }
- }
- int f(int a, int b){
- int tab[20][20];
- for(int i = 0; i < a; i++){
- for(int j = 0; j < b; j++){
- tab[i][j];
- cout << tab[i][j] << " ";
- }
- }
- }
- int main(){
- int b;
- int a;
- cout << "Podaj ilu elementowa ma byc tablica(Liczba dodatnia): ";
- cin >> b;
- cout << f(b);
- cout << "Jesli chcesz dopisac drugi wymiar wpisz liczbe dodatnia o 2 wym:";
- cin >> a;
- cout << f(b,a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement