Guest User

Untitled

a guest
Apr 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. const int M=3;
  2. const int N=4;
  3.  
  4. int pole[M][N], x=0, y=0, i=0;
  5.     string str;
  6.     char *cstr, *pm;
  7.     cstr= new char [str.size()+1];
  8.     ifstream file("file.txt");
  9.     while (getline(file,str,'\n'))
  10.     {
  11.         strcpy(cstr,str.c_str());
  12.         pm=strtok(cstr," ");
  13.         while (pm!=NULL)
  14.         {
  15.             i=atoi(pm);
  16.             pole[x][y]=i;
  17.             y++;
  18.             pm=strtok(NULL," ");
  19.         }
  20.         x++;
  21.     }  
  22.        
  23.     tisk(pole);
Add Comment
Please, Sign In to add comment