Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // cwiczenia petle.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <conio.h>
- #include <malloc.h>
- int main()
- {
- int wiersze, kolumny;
- printf("Podaj liczbe wierszy: ");
- scanf_s("%d", &wiersze);
- printf("\nPodaj liczbe kolumn: ");
- scanf_s("%d", &kolumny);
- double **tablica;
- tablica = (double**)calloc(wiersze, sizeof tablica);
- int i, j;
- for (i = 0; i < wiersze; i++)
- {
- tablica[i] = (double*)calloc(kolumny, sizeof tablica);
- }
- for (i = 0; i < wiersze; i++)
- {
- for (j = 0; j < wiersze; j++)
- {
- printf("\nPodaj wartosci T[%d , %d]: ", i+1, j+1);
- scanf_s("%lf", &tablica[i][j]);
- }
- }
- for (i = 0; i < wiersze; i++ )
- {
- for (j = 0; j < kolumny; j++)
- {
- printf("\nT[%d , %d]: %3.0lf", i+1, j+1, tablica[i][j]);
- }
- printf("\n");
- }
- free(tablica);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement