DiaxPlayer

wczytywanie.h

Oct 24th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string.h>
  4. #include <cstdlib>
  5. #include <conio.h>
  6. using namespace std;
  7.  
  8. void wczytywanie(int **tablica,char znak1)
  9. {
  10.     char znak[13]={'p','r','e','s','e','t','y','/','a','.','t','x','t'};
  11.     znak[8]=tolower(znak1);
  12.     fstream a;
  13.     cout << znak <<endl;
  14.     cout << endl;
  15.     a.open(znak,ios::in);
  16.     if (a.good()==false)
  17.     {
  18.         cout<<"Nie ma takiego pliku!";
  19.         getch();
  20.         exit(0);
  21.     }
  22.     string linia;
  23.     for(int x=0;getline(a,linia);x++)
  24.         for (unsigned int i=0; i<linia.length(); i++)
  25.             if(linia[i]=='1')
  26.                 tablica[x][i]=1;
  27.             else
  28.                 tablica[x][i]=0;
  29.     a.close();
  30. }
Add Comment
Please, Sign In to add comment