Finally this one is working, thanks all.
I have one more question. Should I free the memory space and how?
Code:
// reading a text file
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
int i,j,c;
int Ncoil, Ntank;
int **Tmin, **Tmax;
char str[256];
cout << "Number of coils to be cleaned: ";
cin >> Ncoil;
cout << "Number of tanks: ";
cin >> Ntank;
Tmin = new int *[Ncoil];
ifstream myfile ("Tmin.txt");
if (myfile.is_open())
{
do{
for (int i = 0; i < Ncoil; ++i)
{
Tmin[i] = new int[Ntank];
for(int j = 0; j < Ntank; ++j)
{
myfile >> Tmin[i][j];
/*getline(myfile, line, ' ');
c = atoi(line.c_str());
Tmin[i][j] = c;
cout<< Tmin[i][j]<<endl; */
cout << Tmin[i][j]<<' ';
}
}
}while(!myfile.eof());
myfile.close();
}
else cout << "Unable to open Tmin file";
cin.get();
return 0;
}