Advertisement
Guest User

prosze

a guest
Dec 5th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. // cwiczenia petle.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <conio.h>
  6. #include <malloc.h>
  7.  
  8.  
  9. int main()
  10. {
  11.  
  12.  
  13. int wiersze, kolumny;
  14.  
  15. printf("Podaj liczbe wierszy: ");
  16. scanf_s("%d", &wiersze);
  17. printf("\nPodaj liczbe kolumn: ");
  18. scanf_s("%d", &kolumny);
  19.  
  20. double **tablica;
  21. tablica = (double**)calloc(wiersze, sizeof tablica);
  22. int i, j;
  23. for (i = 0; i < wiersze; i++)
  24. {
  25. tablica[i] = (double*)calloc(kolumny, sizeof tablica);
  26.  
  27. }
  28. for (i = 0; i < wiersze; i++)
  29. {
  30.  
  31. for (j = 0; j < wiersze; j++)
  32. {
  33. printf("\nPodaj wartosci T[%d , %d]: ", i+1, j+1);
  34. scanf_s("%lf", &tablica[i][j]);
  35.  
  36. }
  37. }
  38.  
  39. for (i = 0; i < wiersze; i++ )
  40. {
  41. for (j = 0; j < kolumny; j++)
  42. {
  43. printf("\nT[%d , %d]: %3.0lf", i+1, j+1, tablica[i][j]);
  44. }
  45. printf("\n");
  46. }
  47.  
  48. free(tablica);
  49.  
  50.  
  51. _getch();
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement