I am having issues writing a program.. I have attached the directions that I have gotten.. currently I am getting the following error: 1>c:\users\zoheb\documents\visual studio 2008\projects\dynamic 2d array\dynamic 2d array\dynamic 2d array.cpp(20) : error C2440: '=' : cannot convert from 'int *' to 'int'
Here is my code
#include <iostream>
#include <fstream>
using namespace std;
int main () {
int height, width;
int sum,row,column,value;
int **array;
ifstream inFile("matrix1.dat");
if(!inFile) {
cerr << "File matrix1.dat could not be opened!";
}
inFile >> height >> width;
cout << height << ' '<< width << endl;
**array = &array[height][width];
while(inFile) {
inFile >> row >> column >> value;
array[row][column] = value;
}
//calculate the sum of each row
for (int i=0; i<height; i++) {
sum = 0;
for (int j=0; j<width; j++) {
sum += array[i][j];
}
cout << i << " = " << sum << endl;
}
//calculate the sum of each column
for (int i = 0; i < width; i++) {
sum = 0;
for (int j = 0; j < height; j++) {
sum += array[j][i];
}
cout << i << " = " << sum << endl;
}
for (int i = 0; i < height; i++){
delete[] array[i];
delete[] array;
}
}