Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double** generateMatrix(const int dimensions) {
- double** matrix;
- matrix = new double*[dimensions];
- for (int height = 0; height < dimensions; height++) {
- matrix[height] = new double[dimensions];
- for (int width = 0; width < dimensions; width++) {
- cout << "inserisci riga " << height + 1 << " colonna " << width + 1 << endl;
- cin >> matrix[height][width];
- }
- }
- return matrix;
- }
- void getFirstElement (double **matrice) {
- cout << matrice[0][0];
- }
- int main(void) {
- int dim;
- cout << "Inserire dimensione matrice: ";
- cin >> dim;
- getFirstElement(generateMatrix(dim));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement