title: can we use cin>> in member functions in a class in C++?
body: <p>I'm trying to initialize a class matrix using a member function like thiis</p>
  <pre><code>class mat{
      int r,c;
      float **p;
      
      public:
      
      mat(){}
      mat(int,int);
      void initialize();
  };
  mat :: mat (int r, int c){ //check for float and int if error occurs
      p=new float*[r];
      for(int i=0; i&lt;r; ++i){
          p[i]=new float(c);
      }
  void mat :: initialize(void){
      int i,j;
      cout&lt;&lt;&quot;\nEnter the elements : &quot;;
      for(i=0;i&lt;r;++i){
          for(j=0;j&lt;c;++j){
              cin&gt;&gt;p[i][j];
          }
      }
  }
  int main(){
      mat m1(3,3);
      cout&lt;&lt;&quot;\nInitialize M1&quot;;
      m1.initialize();
      
      
      return(0);
  }
  </code></pre>
  <p>but when i compile and run it and try to initialize a matrix, program never stops to recieve inputs.
  Can anyone tell me what i'm doing wrong?</p>