void main()
{
char op;

op=meniu();
while (op!=5)
{
switch (op)
{
case '1': creare();   break;
case '3': adauga();   break;
case '2': deschide(); break;
case '4': sterge();   break;
default: op=meniu(); break;
}
op=meniu();
}
exit(1);
}
int main ( ) {
  unsigned m,n;
  nod * prim1=NULL, *prim2=NULL, * cat, * rest, * aux;
  cout<<"Nr termeni primul polinom= ";
  cin>>m;
  creare ( prim1, m );
  afiseaza ( prim1 );
  cout<<"Nr termeni al doilea polinom= ";
  cin>>n;
  creare ( prim2, n );
  afiseaza ( prim2 );
  cout<<"suma:\n";
  aux=adunare ( prim1, prim2 );
  afiseaza ( aux );
  cout<<"diferenta:\n";
  aux=adunare ( prim1, negativ ( prim2 ) );
  afiseaza ( aux );
  cout<<"produs:\n";
  aux=mul ( prim1, prim2 );
  afiseaza ( aux );
  cout<<"cat:\n";
  divp ( prim1, prim2, cat, rest );
  afiseaza ( cat );
  cout<<"rest:\n";
  aux=adunare ( prim1, prim2 );
  if ( !rest ) cout<<"0";
  else afiseaza ( rest );
  getch ( );
  return 0;
}  
Exemple #3
0
arb *creare(){
    arb *a;
    char r;
    printf("\n Nod NULL?(D?N)");
    r = getch();
    if(r=='n'||r=='N'){
            a = (arb*)malloc(sizeof(arb));
            printf("info:");
            scanf("%d",&a->inf);
            printf("\nCiteste stinga lui %d",a->inf);
            a->st = creare();
            printf("\nCiteste dreapta lui %d",a->inf);
            a->dr = creare();
            return a;
    }else{
        return NULL;
    }
}
int main ( ) {
  nod *prim,*ultim;
  unsigned n;
  cout<<"creez o lista circulara simplu inlantuita cu n copii;"<<endl; 
  cout<<"n= ";	cin>>n;
  creare ( prim, ultim, n );
  numaratoare ( prim, ultim, n );
  getch ( );
  return 0;
}
Exemple #5
0
int main(){
    listad *q;
    int i;
    q = creare();
    afisareDS(q);

    moveOnes(q);
    afisareDS(q);

    return 0;
}
int main(){
    listad *q;
    q = creare();
    afisareSD(q);
    printf("\nLungimea listei:%d",n);

    stergere_negative(q);
    afisareSD(q);

    return 0;
}
Exemple #7
0
int main(){
    arb *a;

    a = creare();
    printf("\nRSD:");RSD(a);
    printf("\nSRD:");SRD(a);
    printf("\nSDR:");SDR(a);

    printf("\nSuma:%d",suma(a));
    printf("\nMaxim:%d",maxim(a));
    printf("\nNr frunze:%d",frunze(a));
    printf("\nInaltimea:%d",inaltime(a));

    return 0;
}