Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. void Plansza::fillArray(fstream& inFile)
  2. {
  3.     string line;
  4.     while(getline(inFile, line))
  5.     {
  6.         line.erase(remove(line.begin(), line.end(), ' '), line.end());
  7.         cout<<line<<endl;
  8.         for(int j=0;j<getLines();j++)
  9.         {
  10.             for (int i = 0; i<getColumns(); i++)
  11.             {
  12.                 if (line[i] == '0')
  13.                 {
  14.                     tab[j][i]=new Martwa;
  15.                     cout<<tab[j][i]->stan<<endl;
  16.                 }
  17.                 else if (line[i] == '1')
  18.                 {
  19.                     tab[j][i] =new Zywa;
  20.                     cout<<tab[j][i]->stan<<endl;
  21.                 }
  22.                 else if (line[i] == 'H')
  23.                 {
  24.                     tab[j][i] = new Hibernacja;
  25.                     cout<<tab[j][i]->stan<<endl;
  26.                 }
  27.            
  28.                 else if (line[i] == 'O')
  29.                 {
  30.                     tab[j][i] =new Otoczona;
  31.                     cout<<tab[j][i]->stan<<endl;
  32.                 }
  33.                 else if (line[i] == 'T')
  34.                 {
  35.                     tab[j][i] =new Trudna;
  36.                     cout<<tab[j][i]->stan<<endl;
  37.                 }
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement