Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
768 B
4
Indexable
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

void losowanielidczbdotablicy(int tab[10][10]); 
void wyswietlanietablicy(int tab[10][10]);

int main()
{

	srand(time(NULL));

	int tab[10][10];

	losowanielidczbdotablicy(tab);

	wyswietlanietablicy(tab);

}
void losowanielidczbdotablicy(int tab[10][10])
{
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			int minus = rand() % 2;
			int numer = 10 + rand() % 90;

			if (minus == 1)
			{
				numer = -numer;
			}

			tab[i][j] = numer;


		}
	}
}
void wyswietlanietablicy(int tab[10][10])
{
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{

			cout << tab[i][j] << " ";

		}
		cout << endl;
	}
}
Leave a Comment