Treceți la conținutul principal

disciplina cpp

#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <stdio.h>
#include <process.h>


class disciplina
{
public:
 char *denumire;
 char **prof;
 int an,nr;
 
 disciplina()
 {
  denumire=NULL;nr=0;prof=NULL;an=0;
 }

 disciplina(char *den,int n,char **ppx,int a)
 {
  strcpy(denumire,den);nr=n;prof=ppx;an=a;
 }

 disciplina(disciplina &d)
 {
  int i;
  an=d.an;
  nr=d.nr;
  if (d.denumire) 
  {
   denumire=new char[strlen(d.denumire)+1];
   strcpy(denumire,d.denumire);
  }
  else denumire=NULL;
  if (nr>0) 
  {
   prof=new char*[nr];
   for(i=0;i<nr;i++) 
   { 
    prof[i]=new char[strlen(d.prof[i])+1];
    strcpy(prof[i],d.prof[i]);
   }
  }
  else prof=NULL;
 } 

 ~disciplina()
 {
  if (denumire) delete []denumire;
  if (nr>0)
  {
   for (int i=0;i<nr;i++) delete []prof[i];
   delete prof;
  }
 }

 disciplina operator=(disciplina d)
 {   
  int i;
  an=d.an;
 
  if (denumire) delete []denumire;
  denumire=NULL;
  if (d.denumire) 
  {
   denumire=new char[strlen(d.denumire)+1];
   strcpy(denumire,d.denumire);
  }
  if (nr>0)
  {
   for (i=0;i<nr;i++) delete []prof[i];
   delete prof;
   prof=NULL;
  }
  nr=d.nr;
  if (nr>0)
  {
   prof=new char*[nr];
   for (i=0;i<nr;i++) 
   { 
    prof[i]=new char[strlen(d.prof[i])+1];
    strcpy(prof[i],d.prof[i]);
   }
  }
  else prof=NULL;
  return *this;
 }

 disciplina operator+(char *pr)
 {
  disciplina aux;
  int i=0;

  aux.an=an;
  if (denumire)
  {
   aux.denumire=new char[strlen(denumire)+1];
   strcpy(aux.denumire,denumire);
  }
  aux.nr=nr+1;
  if (nr==0)
  {
   aux.prof=new char*[1];
   aux.prof[0]=new char[strlen(pr)+1];
   strcpy(aux.prof[0],pr);
  }
  else if (nr>0)
   {
    aux.prof=new char*[aux.nr];
    for (i=0;i<nr;i++)
    {
     aux.prof[i]=new char[strlen(prof[i])+1];
     strcpy(aux.prof[i],prof[i]);
    }
    aux.prof[nr]=new char[strlen(pr)+1];
    strcpy(aux.prof[nr],pr);
   }
  return aux;
 }

 disciplina operator-(char *pr)
 {
  int i,j=0,contor=0;
  if (nr>0) 
  {
   disciplina aux;
   for (i=0;i<nr;i++)
    if ( (stricmp(prof[i],pr))==0 ) contor=1;
   if (contor==0) return *this;
   else
    {
     aux.nr=nr-contor;
     if (aux.nr>0)
     {
      aux.an=an;
      if (denumire) 
      {
       aux.denumire=new char[strlen(denumire)+1];
       strcpy(aux.denumire,denumire);
      }
      else aux.denumire=NULL;
      aux.prof=new char*[aux.nr];
      for (i=0;i<nr;i++)
       if ( (stricmp(prof[i],pr))!=0 )
       {
        aux.prof[j]=new char[strlen(prof[i])+1];
        strcpy(aux.prof[j],prof[i]);
        j++;
       }
     }
     else
     {
      aux.an=an;
      if (denumire) 
      {
       aux.denumire=new char[strlen(denumire)+1];
       strcpy(aux.denumire,denumire);
      }
      else aux.denumire=NULL;
      aux.prof=NULL;
     }
    return aux;
    }
  }
  else return *this;
 }

 friend ostream &operator<<(ostream &ies,disciplina d)
 {
  int i;
  if (d.denumire) ies<<"\nDenumire disciplina: \t"<<d.denumire<<endl;
   else ies<<"Denumirea disciplinei nu a fost introdusa"<<endl;
  if (d.an>0) ies<<"Anul in care se studiaza disciplina: "<<d.an<<endl;
   else ies<<"Anul nu a fost introdus"<<endl;
  if (d.nr>0)
  {
   ies<<"Numar de profesori: \t"<<d.nr<<endl;
   ies<<"Nume profesori: "<<endl;
   for (i=0;i<d.nr;i++) ies<<"\t"<<d.prof[i]<<endl;
  }
  else ies<<"Nu exista profesori pentru disciplina introdusa";
  ies<<endl;
  return ies;
 }

 friend istream &operator>>(istream &intr,disciplina &d)
 {
  int i;
  char temp[30];
  //Introducere dinamica a denumirii
  cout<<"Denumirea disciplinei: ";intr>>temp;
  d.denumire=new char[strlen(temp)+1];
  strcpy(d.denumire,temp);
  //Introducere dinamica a denumirilor profesorilor 
  cout<<"Numar de profesori: ";intr>>d.nr;
  if (d.nr>0)
  {
   d.prof=new char*[d.nr];
   for (i=0;i<d.nr;i++)
   {
    cout<<"Nume profesor "<<i+1<<": ";intr>>temp;
    d.prof[i]=new char[strlen(temp)+1];
    strcpy(d.prof[i],temp);
   }
  }
  else d.prof=NULL;
  cout<<"Anul de studiu: ";intr>>d.an;
  return intr;
 }
 
 friend ofstream &operator<<(ofstream &ies,disciplina &d)
 {
  int i;
  ies<<d.an<<endl;
  ies<<d.nr<<endl;
  ies<<d.denumire<<endl;
  if (d.nr!=0) for (i=0;i<d.nr;i++) ies<<d.prof[i]<<endl;
  return ies;
 }

 friend ifstream &operator>>(ifstream &intr,disciplina &d)
 {
  int i;
  disciplina aux;
  char temp[30];
 
  intr>>d.an;
  intr>>d.nr;
  
  intr>>temp;
  d.denumire=new char[strlen(temp)+1];
  strcpy(d.denumire,temp);
  if (d.nr>0)
  {
   d.prof=new char*[d.nr];
   for (i=0;i<d.nr;i++)
   {
    intr>>temp;
    d.prof[i]=new char[strlen(temp)+1];
    strcpy(d.prof[i],temp);
   }
  }
  else d.prof=NULL;
  return intr;
 }
 
};

//***************************CLASA AN DE STUDIU*******************************

class an_stud
{
public:
 char **discipline;
 char **prof;
 int an,nrp,nrd;
 
 an_stud()
 {
  discipline=NULL;nrp=0;nrd=0;prof=NULL;an=0;
 }

 an_stud(char **dis,int n1,char **ppx,int n2,int a)
 {
  discipline=dis;nrd=n1;prof=ppx;nrp=n2;an=a;
 }

 an_stud(an_stud &d)
 {
  int i;
  an=d.an;
  nrp=d.nrp;
  nrd=d.nrd;
  
  if (nrd>0) 
  {
   discipline=new char*[nrd];
   for(i=0;i<nrd;i++) 
   { 
    discipline[i]=new char[strlen(d.discipline[i])+1];
    strcpy(discipline[i],d.discipline[i]);
   }
  }
  else discipline=NULL;

  if (nrp>0) 
  {
   prof=new char*[nrp];
   for(i=0;i<nrp;i++) 
   { 
    prof[i]=new char[strlen(d.prof[i])+1];
    strcpy(prof[i],d.prof[i]);
   }
  }
  else prof=NULL;
 } 

 ~an_stud()
 {
  if (nrd>0)
  {
   for (int i=0;i<nrd;i++) delete []discipline[i];
   delete discipline;
  }

  if (nrp>0)
  {
   for (int i=0;i<nrp;i++) delete []prof[i];
   delete prof;
  }
 }

 an_stud operator=(an_stud d)
 {   
  int i;
  an=d.an;
 
  if (nrd>0)
  {
   for (i=0;i<nrd;i++) delete []discipline[i];
   delete discipline;
   discipline=NULL;
  }
  nrd=d.nrd;
  if (nrd>0)
  {
   discipline=new char*[nrd];
   for (i=0;i<nrd;i++) 
   { 
    discipline[i]=new char[strlen(d.discipline[i])+1];
    strcpy(discipline[i],d.discipline[i]);
   }
  }
  else discipline=NULL;

  if (nrp>0)
  {
   for (i=0;i<nrp;i++) delete []prof[i];
   delete prof;
   prof=NULL;
  }
  nrp=d.nrp;
  if (nrp>0)
  {
   prof=new char*[nrp];
   for (i=0;i<nrp;i++) 
   { 
    prof[i]=new char[strlen(d.prof[i])+1];
    strcpy(prof[i],d.prof[i]);
   }
  }
  else prof=NULL;
  return *this;
 }

 an_stud operator-(disciplina &d)
 { 
  int i,j=0,contor=0;
  if (an==d.an)
  {
   if (nrd>0)
   {
    an_stud aux;
    for (i=0;i<nrd;i++)
     if (stricmp(discipline[i],d.denumire)==0) contor=1;
    if (contor==0) return *this;
    else
    {
     aux.nrd=nrd-contor;
     if (aux.nrd>0)
     {
      aux.an=an;
      aux.discipline=new char*[aux.nrd];
      for (i=0;i<nrd;i++)
       if (stricmp(discipline[i],d.denumire)!=0 )
       {
        aux.discipline[j]=new char[strlen(discipline[i])+1];
        strcpy(aux.discipline[j],discipline[i]);
        j++;
       }
     
      int cont=0;
      for (i=0;i<nrp;i++)
      {
       int cc=0;
       for (int k=0;k<d.nr;k++)
        if (stricmp(prof[i],d.prof[k])==0) cc=1;
       if (!cc) cont++;
      }
      
      aux.nrp=cont;
      if (aux.nrp>0)
      {
       aux.prof=new char*[aux.nrp];
       j=0;
       for (i=0;i<nrp;i++)
       {
        int cc=0;
        for (int k=0;k<d.nr;k++)
         if (stricmp(prof[i],d.prof[k])==0) cc=1;
        if (!cc)
        {
         aux.prof[j]=new char[strlen(prof[i])+1];
         strcpy(aux.prof[j],prof[i]);
         j++;
        }
       }
      }
      else 
      {
       aux.nrp=0;
       aux.discipline=NULL;
      }
     }
     else
     {
      aux.an=an;
      aux.discipline=NULL;
      aux.prof=NULL;
     }
    return aux;
    }
   }
   else return *this;
  }
  else return *this;
 }

 an_stud operator+(disciplina &d)
 { 
  int i,j=0;
  if (an==d.an)
  {
   if (!d.denumire) return *this;
   else
   {
    an_stud aux;
    aux.an=an;
    aux.nrd=nrd+1;
    if (nrd==0)
    {
     aux.discipline=new char*[1];
     aux.discipline[0]=new char[strlen(d.denumire)+1];
     strcpy(aux.discipline[0],d.denumire);
    }
    else if (nrd>0)
     {
      aux.discipline=new char*[aux.nrd];
      for (i=0;i<nrd;i++)
      {
       aux.discipline[i]=new char[strlen(discipline[i])+1];
       strcpy(aux.discipline[i],discipline[i]);
      }
      aux.discipline[nrd]=new char[strlen(d.denumire)+1];
      strcpy(aux.discipline[nrd],d.denumire);
     }

    int cc,j=0,contor=0;
    for (i=0;i<d.nr;i++)
    {
     cc=0;
     for (j=0;j<nrp;j++)
      if (stricmp(d.prof[i],prof[j])!=0) cc++;
     if (cc==nrp) contor++;
    }
      
    aux.nrp=nrp+contor;
    if (nrp==0)
    {
     aux.prof=new char*[d.nr];
     for (i=0;i<d.nr;i++)
     {
      aux.prof[i]=new char[strlen(d.prof[i])+1];
      strcpy(aux.prof[i],d.prof[i]);
     }
    }
    else if (nrp>0)
     {
      aux.prof=new char*[aux.nrp];
      for (i=0;i<nrp;i++)
      {
       aux.prof[i]=new char[strlen(prof[i])+1];
       strcpy(aux.prof[i],prof[i]);
      }
      int k=nrp;
      for (i=0;i<d.nr;i++)
      {
       cc=0;
       for (j=0;j<nrp;j++)
        if (stricmp(d.prof[i],prof[j])!=0) cc++;
       if (cc==nrp)
        {
         aux.prof[k]=new char[strlen(d.prof[i])+1];
         strcpy(aux.prof[k],d.prof[i]);
         k++;
        }
      }
     } 
    return aux;
   }
  }
  else return *this;
 }

 an_stud operator+(int a)
 {
  an+=a;
  return *this;
 }

 an_stud operator-(int a)
 {
  an-=a;
  return *this;
 }

 an_stud operator++()
 {
  an++;
  return *this;
 }

 an_stud operator--()
 {
  an--;
  return *this;
 }

 friend ostream &operator<<(ostream &ies,an_stud d)
 {
  int i;
  if (d.an>0) ies<<"Anul in care se studiaza disciplina: "<<d.an<<endl;
   else ies<<"Anul nu a fost introdus"<<endl;
  
  if (d.nrd>0)
  {
   ies<<"Numar de discipline: \t"<<d.nrd<<endl;
   ies<<"Denumiri discipline: "<<endl;
   for (i=0;i<d.nrd;i++) ies<<"\t"<<d.discipline[i]<<endl;
  }
  else ies<<"Nu exista discipline pentru anul introdus"<<endl;
  
  if (d.nrp>0)
  {
   ies<<"Numar de profesori: \t"<<d.nrp<<endl;
   ies<<"Nume profesori: "<<endl;
   for (i=0;i<d.nrp;i++) ies<<"\t"<<d.prof[i]<<endl;
  }
  else ies<<"Nu exista profesori pentru anul introdus";
  ies<<endl;
  return ies;
 }


 friend istream &operator>>(istream &intr,an_stud &d)
 {
  int i;
  char temp[30];
  cout<<"Anul de studiu: ";intr>>d.an;

  cout<<"Numar de discipline: ";intr>>d.nrd;
  if (d.nrd>0)
  {
   d.discipline=new char*[d.nrd];
   for (i=0;i<d.nrd;i++)
   {
    cout<<"\tdisciplina "<<i+1<<": ";intr>>temp;
    d.discipline[i]=new char[strlen(temp)+1];
    strcpy(d.discipline[i],temp);
   }
  }
  else d.discipline=NULL;
  
  cout<<"Numar de profesori: ";intr>>d.nrp;
  if (d.nrp>0)
  {
   d.prof=new char*[d.nrp];
   for (i=0;i<d.nrp;i++)
   {
    cout<<"\tprofesor "<<i+1<<": ";intr>>temp;
    d.prof[i]=new char[strlen(temp)+1];
    strcpy(d.prof[i],temp);
   }
  }
  else d.prof=NULL;
  
  return intr;
 }
 
 friend ofstream &operator<<(ofstream &ies,an_stud &d)
 {
  int i;
  ies<<d.an<<endl;
  ies<<d.nrd<<endl;
  ies<<d.nrp<<endl;
  if (d.nrd!=0) for (i=0;i<d.nrd;i++) ies<<d.discipline[i]<<endl;
  if (d.nrp!=0) for (i=0;i<d.nrp;i++) ies<<d.prof[i]<<endl;
  return ies;
 }

 friend ifstream &operator>>(ifstream &intr,an_stud &d)
 {
  int i;
  char temp[30];
 
  intr>>d.an;
  intr>>d.nrd;
  intr>>d.nrp;
  
  if (d.nrd>0)
  {
   d.discipline=new char*[d.nrd];
   for (i=0;i<d.nrd;i++)
   {
    intr>>temp;
    d.discipline[i]=new char[strlen(temp)+1];
    strcpy(d.discipline[i],temp);
   }
  }
  else d.discipline=NULL;
  if (d.nrp>0)
  {
   d.prof=new char*[d.nrp];
   for (i=0;i<d.nrp;i++)
   {
    intr>>temp;
    d.prof[i]=new char[strlen(temp)+1];
    strcpy(d.prof[i],temp);
   }
  }
  else d.prof=NULL;
  return intr;
 }
 
};

//***************************CLASA PROFESOR*******************************

class prof
{
public:
 char **discipline,*nume;
 int *ani;
 int nra,nrd;
 
 prof()
 {
  discipline=NULL;nrd=0;ani=NULL;nra=0;nume=NULL;
 }

 prof(char **dis,int n1,char *n,int *a,int n2)
 {
  discipline=dis;nrd=n1;strcpy(nume,n);ani=a;nra=n2;
 }

 prof(prof &d)
 {
  int i;
  nra=d.nra;
  nrd=d.nrd;
  
  if (d.nrd>0) 
  {
   discipline=new char*[d.nrd];
   for(i=0;i<d.nrd;i++) 
   { 
    discipline[i]=new char[strlen(d.discipline[i])+1];
    strcpy(discipline[i],d.discipline[i]);
   }
  }
  else discipline=NULL;

  if (d.nra>0) 
  {
   ani=new int[d.nra];
   for(i=0;i<nra;i++) ani[i]=d.ani[i];
  }
  else ani=NULL;

  if (d.nume!=NULL) 
  {
   nume=new char[strlen(d.nume)+1];
   strcpy(nume,d.nume);
  }
  else nume=NULL;
 } 

 ~prof()
 {
  if (nrd>0)
  {
   for (int i=0;i<nrd;i++) delete []discipline[i];
   delete discipline;
  }

  if (ani) delete ani;//ani=NULL;
  if (nume) delete []nume;
 }

 prof operator=(prof d)
 {   
  int i;
   
  if (nume) 
  {
   delete []nume;
   nume=NULL;
  }
  if (d.nume) 
  {
   nume=new char[strlen(d.nume)+1];
   strcpy(nume,d.nume);
  }
  if (nrd>0)
  {
   for (i=0;i<nrd;i++) 
   {
    delete []discipline[i];
    discipline[i]=NULL;
   }
   delete discipline;
   discipline=NULL;
  }
  nrd=d.nrd;
  if (nrd>0)
  {
   discipline=new char*[nrd];
   for (i=0;i<nrd;i++) 
   { 
    discipline[i]=new char[strlen(d.discipline[i])+1];
    strcpy(discipline[i],d.discipline[i]);
   }
  }
  else discipline=NULL;
  if (ani) 
  {
   delete ani;
   ani=NULL;
  }
  nra=d.nra;
  if (d.ani)
  {
   ani=new int[nra];
   for(i=0;i<nra;i++) ani[i]=d.ani[i];
  }
  else ani=NULL;
  return *this;
 }

 friend ostream &operator<<(ostream &ies,prof d)
 {
  int i;
  if (d.nume) ies<<"Numele profesorului: "<<d.nume<<endl;
   else ies<<"Numele profesorului nu a fost introdus !"<<endl;
  
  if (d.nrd>0)
  {
   ies<<"Numar de discipline: \t"<<d.nrd<<endl;
   ies<<"Denumiri discipline: "<<endl;
   for (i=0;i<d.nrd;i++) ies<<"\t"<<d.discipline[i]<<endl;
  }
  else ies<<"Nu exista discipline pentru anul introdus"<<endl;
  
  if (d.nra>0)
  {
   ies<<"Numar de ani la care preda: \t"<<d.nra<<endl;
   ies<<"Anii la care preda: "<<endl;
   for (i=0;i<d.nra;i++) ies<<"\t"<<d.ani[i];
  }
  else ies<<"Profesorul introdus nu preda la nici un an !";
  ies<<endl;
  return ies;
 }

 friend istream &operator>>(istream &intr,prof &d)
 {
  int i;
  char temp[30];
  cout<<"Numele profesorului: ";intr>>temp;
  d.nume=new char[strlen(temp)+1];
  strcpy(d.nume,temp);

  cout<<"Numar de discipline: ";intr>>d.nrd;
  if (d.nrd>0)
  {
   d.discipline=new char*[d.nrd];
   for (i=0;i<d.nrd;i++)
   {
    cout<<"\tdisciplina "<<i+1<<": ";intr>>temp;
    d.discipline[i]=new char[strlen(temp)+1];
    strcpy(d.discipline[i],temp);
   }
  }
  else d.discipline=NULL;
  
  cout<<"Numar de ani la care preda: ";intr>>d.nra;
  if (d.nra>0)
  {
   d.ani=new int[d.nra];
   for (i=0;i<d.nra;i++)
   {
    cout<<"\tAnul: ";
    intr>>d.ani[i];
   }
  }
  else d.ani=NULL;
  
  return intr;
 }

 friend ofstream &operator<<(ofstream &ies,prof &d)
 {
  int i;
  ies<<d.nume<<endl;
  ies<<d.nrd<<endl;
  ies<<d.nra<<endl;
  if (d.nrd!=0) for (i=0;i<d.nrd;i++) ies<<d.discipline[i]<<endl;
  if (d.nra!=0) for (i=0;i<d.nra;i++) ies<<d.ani[i]<<endl;
  return ies;
 }

 friend ifstream &operator>>(ifstream &intr,prof &d)
 {
  int i;
  char temp[30];
 
  intr>>temp;
  d.nume=new char[strlen(temp)+1];
  strcpy(d.nume,temp);
  
  intr>>d.nrd;
  intr>>d.nra;
  
  if (d.nrd>0)
  {
   d.discipline=new char*[d.nrd];
   for (i=0;i<d.nrd;i++)
   {
    intr>>temp;
    d.discipline[i]=new char[strlen(temp)+1];
    strcpy(d.discipline[i],temp);
   }
  }
  else d.discipline=NULL;
  if (d.nra>0)
  {
   d.ani=new int[d.nra];
   for (i=0;i<d.nra;i++) intr>>d.ani[i];
  }
  else d.ani=NULL;
  return intr;
 }


};

void main()
{
//CLASA PROF


 prof aux; 
 int n,i;
  
  ifstream fisin;
  fisin.open("profesori.txt");
  if (!fisin)
  {
   cout<<"Fisierul nu a fost gasit !";
   exit(0);
  }
  n=0;
  fisin>>aux;
  cout<<aux;
  fisin.close(); 


 
/* 
 prof a1,a2;
 cin>>a1;
 
 ofstream fisout;
 fisout.open("profesori.txt",ios::out);
 if (!fisout) 
 {
  cout<<"Eroare la alocare fisier !";
  exit(1);
 }
 fisout<<a1;//salveaza obiectul d1 in fisier
 //fisout<<d2;
 fisout.close();
 
 ifstream fisin;
 fisin.open("profesori.txt",ios::in);
 if (!fisin)
 {
  cout<<"Fisierul nu a fost gasit !";
  exit(2);
 }
 fisin>>a2;//incarca obiectul d1 din fisier
 cout<<a2;//afiseaza obiectul incarcat din fisier
 fisin.close();
*/ 
 
 
 
 
 
 
//CLASA AN DE STUDIU 
/* an_stud a1,a2;
 cin>>a1;
 cout<<"\n";
 disciplina d1;
 cin>>d1;
 cout<<"\n"<<a1+d1;
 

 ofstream fisout;
 fisout.open("an_de_studiu.txt",ios::out);
 if (!fisout) 
 {
  cout<<"Eroare la alocare fisier !";
  exit(1);
 }
 fisout<<a1;//salveaza obiectul d1 in fisier
 //fisout<<d2;
 fisout.close();
 
 ifstream fisin;
 fisin.open("an_de_studiu.txt",ios::in);
 if (!fisin)
 {
  cout<<"Fisierul nu a fost gasit !";
  exit(2);
 }
 fisin>>a2;//incarca obiectul d1 din fisier
 cout<<a2;//afiseaza obiectul incarcat din fisier
 fisin.close();
*/

 
//CLASA DISCIPLINA 
/* disciplina d1,d2;
 //disciplina d2;
 cin>>d1;
 //cout<<d1;
 //disciplina d2,d3;
 //d2=d1;
 
 ofstream fisout;
 fisout.open("disciplina.txt",ios::out);
 if (!fisout) 
 {
  cout<<"Eroare la alocare fisier !";
  exit(1);
 }
 fisout<<d1;//salveaza obiectul d1 in fisier
 //fisout<<d2;
 fisout.close();
 
 ifstream fisin;
 fisin.open("disciplina.txt",ios::in);
 if (!fisin)
 {
  cout<<"Fisierul nu a fost gasit !";
  exit(2);
 }
 fisin>>d2;//incarca obiectul d1 din fisier
 cout<<d2;//afiseaza obiectul incarcat din fisier
 //fisin>>d3;
 //cout<<d3;
 fisin.close();

 
 
 //d2=d1+"GEORGE";
      // cout<<d2;
 //cout<<d2;
 //cout<<d2;
 //d2=d1; 
 //cout<<d1;
 //cout<<d2;
*/

}

Comentarii

Postări populare de pe acest blog

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

NUMERE PRIME ALGORITM C++

// NUMERE PRIME ALGORITM C++//  reediting from scratch //on this page is just the study for a next algoritm for generating the parime nr series like Fibonnaci or ....if possibile

74111121313417374414124343447 if u know the red part you can generate the orange part
1 0 1 111112222 1 1 23

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…