Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cmath>
- #define G 5
- #define F 5
- using namespace std;
- void zapulva(double array[][G], size_t rows);
- void izpisva(double array[F][G]);
- int main()
- {
- double mat[F][G];
- zapulva(mat, F);
- izpisva(mat);
- }
- void zapulva(double array[][G], size_t rows)
- {
- srand(time(NULL));
- for (int i = 0; i < rows; i++)
- {
- for (int j = 0; j < G; j++)
- {
- array[i][j] = (rand() % 205 + (-55));
- }
- }
- for (int i = 0; i < rows; i++)
- {
- for (int j = 0; j < G; j++)
- {
- array[i][j] /= 100;
- }
- }
- }
- void izpisva(double array[F][G])
- {
- int counter = 0;
- for (int i = 0; i < F; i++)
- {
- for (int j = 0; j < G; j++)
- {
- if (counter< 10)
- {
- cout << "0" << counter << ":" << array[i][j] << " ";
- }
- else
- {
- cout << counter << ":" << array[i][j] << " ";
- }
- counter++;
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement