Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <fstream>
- using namespace std;
- class Automat
- {
- char * alfabet;
- int nr_stari;
- int * stari;
- int stare_initiala;
- int nr_stari_finale;
- int * stari_finale;
- int nr_much;
- char ***a; //structura automatului
- public:
- Automat();
- void citire();
- void initializare_matrice();
- };
- Automat::Automat()
- {
- alfabet=NULL;
- stari=NULL;
- stari_finale=NULL;
- a=NULL;
- nr_stari=0;
- stare_initiala=0;
- nr_stari_finale=0;
- nr_much=0;
- }
- void Automat::initializare_matrice()
- {
- cout<<nr_stari<<' ';
- int lung=strlen(alfabet);
- cout<<lung;
- for(int i=0;i<nr_stari;i++) //pe linii sunt starile
- for(int j=0;j<lung;j++)
- {
- cout<<9; a[i][j][0]='\0'; //fiecare element e un string, initial fiind vid
- }//pe coloane sunt simbolurile din alfabet
- }
- int caut(void *v,int n,const void * x,int dim)
- {
- char * p;
- p=(char *) v;
- for(int i=0;i<n;i++)
- if(memcmp(p+i*dim,x,dim)==0)
- return 1;
- return 0;
- }
- void Automat::citire()
- {
- /* ifstream fin("date_automat.in");
- char s[100];
- fin>>s;
- alfabet=new char[strlen(s)+1];
- strcpy(alfabet,s);
- cout<<alfabet;
- fin>>nr_stari;
- stari=new int[nr_stari];
- for(int i=0;i<nr_stari;i++)
- fin>>stari[i];
- //cout<<nr_stari;
- */
- nr_stari=3;
- alfabet="ab";
- initializare_matrice();
- cout<<1;
- /*fin>>stare_initiala;
- fin>>nr_stari_finale;
- stari_finale=new int[nr_stari_finale];
- for(int i=0;i<nr_stari_finale;i++)
- fin>>stari_finale[i];
- fin>>nr_much;
- for(int i=0;i<nr_much;i++)
- {
- int x,y,lit;
- fin>>x>>y>>lit;
- }
- fin.close();
- */
- }
- int main()
- {
- Automat A;
- A.citire();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement