Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication10.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <stdlib.h>
- #include <malloc.h>
- #include <Windows.h>
- int main()
- {
- float **tab;
- int wiersz, kolumny;
- do
- {
- printf("Podaj liczbe wierszy: ");
- scanf_s("%d", &wiersz);
- printf("Podaj liczbe kolumn: ");
- scanf_s("%d", &kolumny);
- } while (wiersz < 0 || kolumny < 0);
- tab = (float**)malloc(wiersz * sizeof(float*));
- for (int i = 0; i<wiersz; i++)
- {
- tab[i] = (float*)malloc(kolumny * sizeof(float));
- }
- for (int i = 0; i < wiersz; i++)
- for (int j = 0; j < kolumny; j++)
- {
- printf("T[%d][%d] = ", i + 1, j + 1);
- scanf_s("%f", &tab[i][j]);
- }
- for (int i = 0; i < wiersz; i++)
- {
- for (int j = 0; j < kolumny; j++)
- printf("%.0f", tab[i][j]);
- printf("\n");
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement