BluePink BluePink
XHost
Servere virtuale de la 20 eur / luna. Servere dedicate de la 100 eur / luna - servicii de administrare si monitorizare incluse. Colocare servere si echipamente de la 75 eur / luna. Pentru detalii accesati site-ul BluePink.

BILET 1

C++

#include<iostream.h>
#include<conio.h>
void main()
{float v[100],m1=0,s=0,s1;
int i,j,n;

cout<<"n=";cin>>n;
for(i=1;i<=n;i++)
{cout<<"v["<<i<<"]=";
cin>>v[i];}

for(i=1;i<=n;i++)
s=s+v[i];
s1=s/n;
cout<<"ma a elem vect="<<s1<<endl;


for(i=1;i<=n;i=i+2)
{m1=(v[i]+v[i+1])/2;
for(j=n;j>=i+1;j=j-1)
v[j+1]=v[j];
v[i+1]=m1;
n++;
}
cout<<endl;
n--;
for(i=1;i<=n;i++)
cout<<v[i]<<" ";

}

 

VISUAL FOX
1

create elevi.dbf
a) accept "x=clasa" to x
input "y=medie" to y
list all for clasa = x .and. medie > y
b) delete all for medie <s
list
recall
list
c) modi stru
d) list record 3
e) sort to elevi1 on nume
use elevi1
list

BILET 2

#include<iostream.h>
#include<conio.h>
void main()
{int max,n,i,j,k;float s[100]={0},v[100];
clrscr();
cout<<"n=";
cin>>n;
for(i=1;i<=n;i++)
{cout<<"v["<<i<<"]=";
cin>>v[i];}
max=v[1];
for(i=2;i<=n;i++)
if(max<v[i])
max=v[i];
cout<<"maximul="<<max<<endl;
k=0;
for(i=1;i<n;i++)
{float q=0;
for(j=1;j<=n;j++)
if(j!=i&&j!=i+1)
q+=v[j];
q=q/(n-2);
s[++k]=q;}
int q=1;
for(i=1;i<n;i+=2)
{for(j=n;j>=i+1;j--)
v[j+1]=v[j];
v[i+1]=s[q];
n++;
q++;}
cout<<"vectorul dupa inserare este:"<<endl;
for(i=1;i<=n;i++)
cout<<v[i]<<endl;
getch();
}

2.
create campion.dbf
a) accept to x
list all for e1=x .or. e2=x
b) list all for data=date()
c) copy struct to campionat.dbf fields e1,e2,g1,g2
use campionat.dbf
list
d) count to y

BILET 3

#include<iostream.h>
void main()
{int n,i,k,x,y;
cin>>k;
for(x=0;x<=k;x++)
for(y=0;y<=k;y++)
if(x*x+y*y==k)
cout<<"("<<x<<","<<y<<")";
cout<<endl;
}

3.
create examen.dbf
a) modi struct //adaugam campul media//
replace all media with (proba1+proba2)/2
list
insert blank
calculate max(proba_practica) to x
go bottom
replace proba_practica with x
list
b)accept to x
input to y
replace proba_practica with y for candidat=x
list
c) accept to u
delete all for cls=u
list
d) copy to examen1.dbf fields candidat, media
use examen1
list
e)index on nume to examen1.idx
use examen.dbf index examen1.idx
list

BILET 4

#include<iostream.h>
int n, i, j, aux, min, poz, gasit;
float x, y, a[100], b[100];
void citire(float v[100], int m)
{for(int i=1;i<=m;i++)
{cout<<"elementul "<<i<<" este ";
cin>>v[i];}
}
void main()
{cout<<"n";
cin>>n;
citire(a,n);
citire(b,n);
for(i=1;i<n;i++)
for(j=i+1;j<=n;j++)
if(a[i]>a[j]) {aux=a[i];
a[i]=a[j];
a[j]=aux;}

for(i=1;i<n;i++)
{min=b[i];poz=i;
for(j=i+1;j<=n;j++)
if(min>b[j]){poz=j;
min=b[j];}
aux=b[poz];
b[poz]=b[i];
b[i]=aux;
}
gasit=0;
x=a[1]/b[1];
for(i=2;i<=n && !gasit;i++)
{y=a[i]/b[i];
if(y!=x) gasit=1;
}
if(gasit) cout<<"vectorii nu sunt proportionali";
else cout<<"vectorii sunt proportionali";
}

4.
create carti.dbf
a) accept to x
replace pret with pret+10 for editura=x
b) calculate sum(nr_pag) for editura=x
c) list titlu for editura=x
d) sort to nou.dbf on titlu
use nou.dbf
list
e) locate for autor="eminescu"
insert blank
list

BILET 5

#include<iostream.h>
#include<math.h>
int cifre(int t)
{int v[10],i=1,j,k;
do
{v[i]=t%10;
t=t/10;
i++;}
while (t!=0);
for(j=1;j<i;j++)
for(k=j+1;k<=i;k++)
if(v[j]==v[k])
return 0;
return 1;
}

void main()
{int i,k;
cin>>k;
for(i=1;i<=k;i++)
if(sqrt(i)==ceil(sqrt(i)) && cifre(i)==1)
cout<<i<<" ";}

5.
create teatru.dbf
a) accept to d1
x1=ctod(d1)
accept to d2
x2=ctod(d2)
accept to v
list all for oras=v .and. x1<data .and. data<x2
b) accept to y
accept to x
count to n for autor=y .and. presa=x
c) accept to d3
x3=ctod(d3)
delete all for data<x3
list

BILET 6

#include<iostream.h>
void main()
{unsigned x[50],a[50][50],i,j,k,n,m;
cout<<"dati nr de linii si de coloane:";
cin>>n>>m;
cout<<"dati vectorul:";
for(i=1;i<=n;i++)
cin>>x[i];
cout<<"dati matricea:";
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
cin>>a[i][j];

cout<<"matricea introdusa este:";
for(i=1;i<=m;i++)
{for(j=1;j<=n;j++)
cout<<a[i][j]<<" ";
cout<<endl;}
cout<<"dati nr liniei care se inlocuieste:";
cin>>k;
for(i=1;i<=n;i++)
a[k][i]=x[i];

for(k=1;k<=m;k++)
{for(j=1;j<=n;j++)
cout<< a[k][j]<<" ";
cout<<endl;}
}

6.
create elevi.dbf
a) list nume,clasa for admis=.t.
b) list nume for abs>= 50
c) delete for media<5
list
d) list clasa,sala for n1>=5 .and. n2>=5

BILET 7

#include <iostream.h>
#include <math.h>

void main()
{
int p[100], n, a;
float r=0;
cout<<"Gradul polinomului este: ";
cin>>n;
cout<<"Introducem coeficientii, incepand de la x^"<<n<<": "<<endl;
for (int i=n;i>=0;i--)
{
cout <<"x^"<<i<<": ";
cin>>p[i];
}
cout<<"Calculam impartirea lui P(X) la x-a; introduceti a: ";
cin>>a;
for (i=n;i>=0;i--)
r=r+p[i]*pow(a,i);
cout<<"Restul este: "<<r<<".";
}

 

7.
create nero.dbf
a) list nume, varsta, crestin
b) list all for sex="fem" .and. varsta<25 .and. crestin=.t.
c) sort to femeie.dbf on nume for sex="fem" .and. varsta>25 .and. varsta<40 .and. crestin=.f.
use femeie.dbf
list

BILET 8

#include<iostream.h>
int prim (int x)
{ int i,nr=0;
for(i=2;i<x/2;i++)
if(x%i==0) return 0;

return 1;

}
void main()
{ int v[105],n,i,s=0;
cout<<"n="; cin>>n;
for(i=1;i<=n;i++)
{ cout<<"v["<<i<<"]=";
cin>>v[i];
if(prim(v[i])) s=s+v[i];
}
cout<<s;
}

8.
create farmacie.dbf
a) list
b) list farmacie for medicament="aspirina"
c) list medicament for specificatii != "fara" .and. retea=.t.
d) list medicament, cant, pret for farmacie=1


BILET 9

#include<iostream.h>
int prim (int x)
{ int i,nr=0;
for(i=2;i<x/2;i++)
if(x%i==0) return 0;

return 1;

}
void main()
{ int v[105],n,i,s=0;
cout<<"n="; cin>>n;
for(i=1;i<=n;i++)
{ cout<<"v["<<i<<"]=";
cin>>v[i];
if(prim(v[i])) s=s+v[i];
}
cout<<s;
}

9.
create firma.dbf
a)list all cantitate, pret for firma="Dunarea"
b)list all for pret>1.000.000
c) list all for produs="zahar"
list cantitate, pret

BILET 10

#include<iostream.h>
void main()
{ int n,v[100],i,j,piv,aux,k;
cout<<"n="; cin>>n;
cout<<"k="; cin>>k;
for(i=1;i<=n;i++)
{ cout<<"v["<<i<<"]=";
cin>>v[i]; }
for(piv=1;piv<=k-1;piv++)
for(i=piv+1;i<=k;i++)
if(v[piv]>v[i])
{aux=v[piv];
v[piv]=v[i];
v[i]=aux;
}
for(piv=k+1;piv<=n-1;piv++)
for(j=piv+1;j<=n;j++)
if(v[piv]<v[j])
{aux=v[piv];
v[piv]=v[j];
v[j]=aux; }
for(j=1;j<=n;j++)
cout<<" "<<v[j]<<endl;

}

10.
create personal.dbf
a)list all for left(nume,1)="a" .and. left (prenume,1)="r"
b)list all for left(nume,1)="b" .and. year (data_a)=04 .and. left(prenume,1)="g"
c)list all for functia=3 .and. salariu<1500000
d)list nume for year(data_n)>=75
list nume for year(data_n)<55 .and. functia !=3

BILET 11

#include<iostream.h>
void main()
{int v[20],n,i,ma=0,nr=0;
cin>>n;
for(i=1;i<=n;i++)
cin>>v[i];
for(i=1;i<=n;i++)
ma=ma+v[i];
ma=ma/n;
for(i=1;i<=n;i++)
if(v[i]<ma)
nr++;
cout<<"nr de elem care sunt mai mici decat ma este "<<nr;
}

11.
create elevi.dbf
a)list all nume, media >7,55
b)delete all for clasa=12
c)replace all clasa with clasa+1 for clasa<12
d)replace all media with media+1 for clasa=11

BILET 12

#include<iostream.h>
#include<conio.h>

int baza(int n,int b)
{while(n)
{if(n%10>b-1) return 0;
n=n/10;}
return 1;
}


void main()
{clrscr();
int n,b;
cout<<"n=";cin>>n;
do {cout<<"b=";cin>>b;}
while(b>10);
if(baza(n,b))
cout<<"DA";
else
cout<<"NU";
getch();
}

12.
create balanta.dbf
a)replace all stoc_final with 0 for stoc_final<0
list
b)sort to balanta1.dbf on nume_material
use balanta1.dbf
list
c) list all for stoc_final>0

BILET 13

#include<iostream.h>
#include<conio.h>
int p,n,b,n1,n10;
void main()
{
clrscr();
cout<<" numarul este";
cin>>n;
n1=n;
do
{
if(b<=(n1%10))
b=n1%10;
n1=n1/10;
}
while(n1);
b++;
cout<<"baza minima in care poate fi considerat "<<n<<" scris corect, este "<<b<<endl;
p=1;
do
{
n10=n10+p*(n%10);
p=p*b;
n=n/10;
}
while(n);

cout<<"numarul in baza 10 este" <<n10<<endl;
getch();

}

13 .
create stocuri .dbf
1) list all for cond= .t.
2) list all for cantit < cant_nor
3) list all for val > 1000000
4) list all for left (cod,1) = "1".and.month(data_misc)>=4

BILET 14

#include<iostream.h>
#include<conio.h>

int sum_div(int n)
{int s=0;
for(int i=1;i<=n/2;i++)
if(!(n%i))
s+=i;
return s==n;
}


void main()
{clrscr();
int n;
cout<<"n=";cin>>n;
if(sum_div(n)) cout<<"Numarul este perfect!!!!";
else cout<<"Nici gand";
getch();
}

14.
create elevi.dbf
a) accept "x=clasa" to x
imput "y=medie" to y
list all for clasa = x .and. medie > y
b) delete all for medie <s
recall
c) modi stru
d) list record 3
e) sort to elevi1 on nume
use elevi1
list

BILET 15

#include<iostream.h>
#include<conio.h>

void main()
{int i,v[100],n,s=0;
float m;
clrscr();

cout<<"n=";cin>>n;
for(i=1;i<=n;i++)
{cout<<"dati componentele vectorului ";
cin>>v[i];
s+=v[i];}

m=(float)s/n;
cout<<"media "<<m<<endl;;

for(i=1;i<=n;i++)
if(v[i]<m)
cout<<" "<<v[i]<<" ";
getch();
}

15.
create cresa.dbf
1)list nume for varsta>2
2) sort to cresa1. on prenume
use cresa1
list
3) replace nume with "cristi" for left (nume,1) = "a"
4)delete all for varsta > 4
list

BILET 16

#include<iostream.h>
#include<conio.h>
int v[100];
void main()
{int k=0,x,inv=0,c;
clrscr();
cout<<"x=";cin>>x;
do
{c=x%10;
inv=inv*10+c;
x=x/10;
k++;
}
while(x!=0);
cout<<inv<<" "<<k;
getch();
}

16.
create librarie.dbf
a)list nume_lib for adresa="Str. Macului"
b)sort to lib on nume_lib for vanzari>2000000
use lib
list
c)use librarie
replace all stoc with stoc+50.000
list
d)locate for titlu_carte="Padurea Spanzuratilor"
display

BILET 17

#include<iostream.h>
#include<conio.h>
int a[100],v[10],ok=1,i,m=0,n;
long int nr;
void main()
{
clrscr();
cout<<"numarul este:";
cin>>nr;

while(nr)
{a[++m]=nr%10;
nr=nr/10;
v[a[m]]++;
}

for(i=m;i>0;i--)
{if (m%2 && i==m/2+1)i--;
if (!(m%2) && i==m/2+1)i-=2;
cout<<a[i];
}
cout<<endl;
for(i=0;i<=9;i++)
{if(v[i])cout<<"cifra "<<i<<"folosita de "<<v[i]<<" ori"<<endl;
if(v[i]>1) ok=0;
}
if(ok)
cout<<"Nr are cifre distincte";
else
cout<<"Nr nu are cifre distincte";
getch();
}

17.
create hotel.dbf
a)list nume_clienti for left(nume_clienti,1)="p"
b)list nume_hotel for oras="constanta"
c)delete all for nr_locuri<50
list
d)list nume_hotel for year(data_infiintarii)<1950

BILET 18

#include<iostream.h>

int a[100],m,b[100],n,j,i,ok,dif[100],re[100],in[100],lin=0, lre=0, ldif=0;
void main()
{
cout<<"n=";cin>>n;
cout<<"m=";cin>>m;
for(i=1;i<=n;i++)
{cout<<"a["<<i<<"]=";
cin>>a[i];
}
for(i=1;i<=m;i++)
{cout<<"b["<<i<<"]=";
cin>>b[i];
}
for(j=1;j<=m;j++)
re[++lre]=b[j];

for(i=1;i<=n;i++)
{ok=0;
for(j=1;j<=m;j++)
if(a[i]==b[j])
ok=1;
if(ok)
in[++lin]=a[i];
else
re[++lre]=dif[++ldif]=a[i];
}
cout<<"Reuniunea este:";
for(i=1;i<=lre;i++)
cout<<re[i]<<" ";
cout<<endl;
cout<<"Intersectia este:";
for(i=1;i<=lin;i++)
cout<<in[i]<<" ";
cout<<endl;
cout<<"Diferenta este:";
for(i=1;i<=ldif;i++)
cout<<dif[i]<<" ";
cout<<endl;
}

18.
create firma.dbf
a)list all cantitate, pret for firma="Dunarea"
b)list all for pret>1.000.000
c) list all for produs="zahar"
list cantitate, pret

BILET 19

#include<fstream.h>
#include<conio.h>
ifstream f("F1.dat");
int cmmdc(int x,int y)
{
while(x!=y)
if(x>y)x-=y;
else y-=x;
return x;
}
void main()
{ clrscr();
int n,i,x,y;
f>>n;
for(i=1;i<=n;i++)
{
f>>x>>y;
cout<<"cmmdc("<<x<<","<<y<<")="<<cmmdc(x,y)<<endl;
}
getch();
}

19.
create produse.dbf
create nomenc.dbf
create preturi.dbf
1) use produse in 1
sele 1
sort to produse1 on codp
use produse1
list
use nomenc in 2
sele 2
sort to nomenc1 on codp
use nomenc1
list
use preturi in 3
sele 3
sort to preturi1 on codp
use preturi1
list
2) sele 3
calculate min (pret) to x
locate for pret = x
n = codp
sele 1
locate for codp = n
m = cant
sele 2
locate for codp = n
p= denp
? n,p,x,m,x*m
3) sele 1
count to y for cant =0
? y
4) sele 3
calculate max (pret) to z
locate for pret = z
c = codp
sele 2
list denp for codp = k

BILET 20

#include<fstream.h>
#include<conio.h>
int cmmdc(int x,int y)
{
while(x!=y)
if(x>y)x-=y;
else y-=x;
return x;
}
void main()
{
clrscr();
int mult,x,y;
//f>>x>>y;
cout<<"x=";cin>>x;
cout<<"y=";cin>>y;
mult=(x*y)/cmmdc(x,y);
cout<<"cel mai mic multiplu comun este"<<mult;
getch();
}

20.
create personal.dbf
1) calculate avg (salariu) to x
? 'salariu=',x
2) sum (salariu)
3) count to x
? 'nr. de salarii=',x
4) calculate max(salariu) to y
list nume, functie for salariu=y

BILET 21

#include<iostream.h>
#include<conio.h>
int prim(int n)
{if(n==0||n==1)
return 1;
else
for(int i=2;i<=n/2;i++)
if(n%i==0) return 0;
return 1;
}
void main()
{int n,i,j,n1;
clrscr();
cout<<"n=";cin>>n;n1=n;
while(prim(n)==0)
n++;
cout<<"cel mai mic nr prim >=n este:"<<n<<endl;

n=n1;
while(prim(n)==0)n--;
cout<<"cel mai mare nr prim <=n este:"<<n;

getch();
}



21.
create pers.dbf
1)list nume for avans<=40000
2)list nume for salariu<=1500000
3)use pers.dbf
sort to doc.dbf on avans/d , salariu/d
use doc.dbf
list
4) sort to doc2.dbf on nume
for impozit>=50000
use doc2.dbf
list next 3

BILET 22

#include<fstream.h>
#include<conio.h>
fstream f("media.txt",ios::out);
void main()
{ int n,s=0,k=0;
clrscr();
do
{cout<<"n=";cin>>n;
if(n%2==0){s+=n;
k++;} }
while(n!=0);
if(--k)
f<<(float)s/k;
}

22.
create sportivi.dbf
create antrenori.dbf
1)use antrenori.dbf
count to x
?'nr.de tari=',x
2)accept to y
use
list nume for tara=y
use sportive.dbf
list nume for tara=y
modi struct ('creez campul media')
replace all media with (nota1+nota2+nota3)/3
calculate max(media) to x
list nume for media=x

BILET 23

#include<iostream.h>
#include<conio.h>
void main()
{int n,i,fib[1000]={0};
clrscr();
cout<<"n=";cin>>n;
fib[0]=0;fib[1]=1;
cout<<"/nfib["<<0<<"]=0 ";
cout<<"/nfib["<<1<<"]=1 /n";
for(i=2;i<n;i++)

{fib[i]=fib[i-1]+fib[i-2];
cout<<"fib["<<i<<"]="<<fib[i]<<endl;
}
getch();
}

23.
create bolnavi.dbf
create personal.dbf
1)list all nume_c for date() - data_i>14
2) use personal.dbf
copy fields nume, etaj to asist.dbf for medic=.f.
use asist.dbf
list
use personal.dbf
copy fields nume to medici.dbf for medic=.t.
use medici.dbf
list
3) use bolnavi.dbf
sort to boln.dbf on nume
use boln.dbf
list

BILET 24

#include <iostream.h>

int n;

int fib (int k)
{
if (k==0)
return 0;
else
if (k==1)
return 1;
else
return fib(k-1)+fib(k-2);
}

int det_fib_max (int k)
{
int i=0;
int q;
while (fib(i+1)<=k)
i++;
return fib(i);
}


void main()
{
cout<<"n= ";
cin>>n;
cout<<n<<"= ";
int v[100];
int i=0;
do
{
i++;
v[i]=det_fib_max(n);
n=n-det_fib_max(n);
}
while (n);
for (int j=1;j<i;j++)
cout<<v[j]<<"+";
cout<<v[i];
}

24.
create elevi.dbf
create adrese.dbf
1.use elevi.dbf in 1 alias el
2.use adrese.dbf in 2 alias adr
3.select 2
list all nume
4.select 1
list all nota2
5.select 1
6. list nume,nota1,nota2
select 2
list all nume,adresa

BILET 25

#include<iostream.h>
void main()
{int n, x, y;
cout<<"Introduceti nr de scris ca suma de 2 nr consecutive:";
cin>>n;

if(n%2!=0)
{ cout<<"Nr poate fi scris ca sume de 2 nr consecutive\n";
cout<<n/2<<"+"<<n/2+1<<"="<<n<<endl;}
else cout<<"Nr nu poate fi scris ca suma de 2 nr consecutive\n";

}

25.
create pers.dbf
sort to p1.dbf on pers.nume/a, pers.data_ang/d
use p1.dbf
list
sort to p2.dbf on pers.nr.copii/a fields pers.nume, pers.nr_copii
use p2
list
sort to p3.dbf on pers.avans/a, pers.nume/d
use p3
go top
list next 5
sort to p4.dbf on pers.avans for left(nume,3)='ion'

BILET 26

#include <iostream.h>
void main()
{
int a,b;
cout<<"a= ";
cin>>a;
cout<<"b= ";
cin>>b;
int v[10], x[10];
int n=0,m=0;
while (a)
{
n++;
v[n]=a%10;
a=a/10;
}
while (b)
{
m++;
x[m]=b%10;
b=b/10;
}
int i,j, z[10], t=0;
for (i=1;i<=n;i++)
for (j=1;j<=m;j++)
if(v[i]==x[j])
{
t++;
z[t]=v[i];
}
for (i=t;i>=1;i--)
cout<<z[i]<<" ";
}

26.
create pers.dbf
use pers.dbf
1)sort to p1.dbf on impozit/a, nume/d, nr_copii/d
use p1.dbf
list
2)sort to p2.dbf on salariu/a for left(nume,3)='ion'
use p2.dbf
list
3)sort to p3.dbf on nume/d, functie/a, nr_copii/d
use p3.dbf
x='01.31.94'
x1=ctot(x)
y='01.31.95'
y1=ctod(y)
list all for data_ang>=x1 && data_ang<=y1
4)sort to p4.dbf on salariu/a, avans/d
for salariu>="200000" && left(nume,1)='n'
use p4.dbf
list

BILET 27

#include <iostream.h>

int n, v[100];

void citire_date()
{
cout<<"n= ";
cin>>n;
for (int i=1;i<=n;i++)
cin>>v[i];
}

void sortare()
{
int i,j, aux;
for (i=1;i<n;i++)
for (j=i+1;j<=n;j++)
if (v[j]<v[i])
{
aux=v[i];
v[i]=v[j];
v[j]=aux;
}
}

void afisare_adunari()
{
for (int i=1;i<n;i++)
{
cout<<v[i]<<"+"<<v[i+1]-v[i]<<"="<<v[i+1];
cout<<endl;
}

27.
create elevi.dbf
1)modi struct // se adauga campul media
replace all media with (nota1+nota2)/2
list all
2)calculate avg(nota1) to n1
calculate avg(nota2) to n2
?n1,n2
3)calculate avg(media ) to t
?t

BILET 28

#include<iostream.h>
int cmmdc(int m,int n)
{if(m>0&&n>0)
if (m==n)return m;
else
if (m<n)return cmmdc(m,n-m);
else return cmmdc(m-n,n);
return 1;
}
void main()
{int n,i,a[100];
cout<<" n= ";
cin>>n;
cout<<endl;
cout<<"da numerele ";
cout<<endl;
for(i=1;i<=n;i++)
cin>>a[i];
cout<<endl;
int d;
d=cmmdc(a[1],a[2]);
for(i=3;i<=n;i++)
d=cmmdc(d,a[i]);
cout<<d;}

28.
create admit.dbf
1)go top
insert blank
x=(proba1+proba2)/2
calculate max(pr_pr) to y
replace pr_pr with x
replace proba1 with y
display
2)replace all pr_pr with pr_pr+1 for pr_pr<=9
3)accept to u
delete all for clasa=u
list
4) sort to admis.dbf on media/d fields admit.cond, admit. medie
use amis.dbf
list

5)index to fis.idx on cond
list admit index fis.idx

BILET 29

#include<iostream.h>
void main()
{int n, f,p;
cout<<"n=";
cin>>n;
cout<<"n=";
f=2;
while(n>1)
{p=0;
while(n%f==0)
{p++;
n=n/f;}
if(p!=0)cout<<f<<"^"<<p<<" ";
f++;}
}

29.
create carti.dbf
1.accept to x
replace all pret with pret+pret*0,1 for autor=x
list
2.accept to x
sum(nrpag) to y for editura=x
?y
3.accept to w
list all titlu for titlu=w
4.sort to carti2.dbf on titlu
use carti.dbf
list
5.use carti.dbf
locate for autor="eminescu"
insert blank
list

BILET 30

#include<iostream.h>
#include<math.h>
void main()
{int k,n,i,r[100],s=0;
cout<<"dati numarul";
cin>>n;
s=n;
k=0;
while(n!=0)
{

r[++k]=n%2;
n=n/2;
}
cout<<s<<"=";
for(i=1;i<=k;i++)
if(r[i]!=0&&i<k)
cout<<"2^"<<i-1<<"+";
else
if (i==k&&r[i]!=0)cout<<"2^"<<i-1;

}

30.create spectacol.dbf
1)accept to x
accept to d1
accept to d2
d1=ctod(d1)
d2=ctod(d2)
list all for orasul=x && perioada>d1 && perioada<d2
2)accept to x
accept to y
count for piesa=x && autor=y
3)accept to x
accept to y
delete all for piesa=x && perioada>y
list

BILET 31

#include<iostream.h>
#include<conio.h>

int p,n,fact=0,temp,i;


void main()

{ clrscr();
cout<<"n=";cin>>n;
cout<<"p=";cin>>p;
for(i=2;i<=n;i++)
{temp=i;
while(temp%p==0)
{fact++;
temp=temp/p;
} }


cout<<"ordinul de multiplicitate al lui "<<p<<" este "<<fact;
getch(); }

31.
1.create farmacie
2.accept to x
list all farm for medicament=x
3.list all medicament for reteta=.t.
4. list medicament,cantitate,pret for farm=1

BILET 32

#include <iostream.h>

int n;

struct nod
{
int nr;
nod* adr;
};

nod *p, *u;

void citire_date()
{
nod *q;
cout<<"n= ";
cin>>n;
for (int i=1;i<=n;i++)
if(!p)
{
p=new nod;
cin>>p->nr;
p->adr=0;
u=p;
}
else
{
q=new nod;
cin>>q->nr;
q->adr=0;
u->adr=q;
u=q;
}
u->adr=p;
}

void permutari()
{
nod *aux;
aux=p;
nod *q;
do
{
q=p;
do
{
cout<<q->nr<<" ";
q=q->adr;
}
while(q!=p);
p=p->adr;
cout<<endl;
}
while (aux!=p);
}

void main()
{
citire_date();
permutari();
}

32.
create firma.dbf
1.list all cantitate,pret for firma="marex"
2.list all produs for pret>1000000
3.list all cantitate,pret for produs="zahar"
4.replace all pret with pret+pret*0,15
list all pret,nume

BILET 33

#include <iostream.h>
int n, k;

int nr_ap (int nr)
{
int i=0;
while (nr)
{
if(nr%10==k)
i++;
nr=nr/10;
}
return i;
}

int nr_ap_total()
{
int count=0;
for (int i=1;i<=n;i++)
count+=nr_ap(i);
return count;
}

void main()
{
cout<<"n= ";
cin>>n;
cout<<"k= ";
cin>>k;
cout<<nr_ap_total();
}

33.
create elev.dbf
list nume for media_admitere>6
delete all for clasa=12
replace all clasa with clasa+1 for clasa<12
replace all media_admitere with media_admitere +1 for clasa=1 && media_admitere<=9
list

BILET 34

#include<iostream.h>
int prim(unsigned int a)
{if(a==1||a==0)
return 0;
for(unsigned int i=2;i<a;i++)
if(a%i==0)
return 0;
return 1;
}
void main()
{unsigned int i,n,v[100],s=0;
cout<<"n=";cin>>n;
for(i=1;i<=n;i++)
{cout<<"v["<<i<<"]=";
cin>>v[i];}

for(i=1;i<=n;i++)
if(prim(v[i]))
s+=v[i];
cout<<"suma elementelor prime este "<<s;
}

34.
create stocuri.dbf
1.replace all stoc_final with 0 for stoc_final<0
list
2.sort to stocuri2.dbf on nume_material
use stocuri2.dbf
list
3.use stocuri.dbf list all for stoc_final >0
4.delete all for data_intrarii>date( )
list

BILET 35

#include<iostream.h>
int nrdiv(unsigned int a)
{int k=1;
for(int i=1;i<=a;i++)
if(a%i==0)
k++;
return k;
}
void main()
{unsigned int v[100];
int n,i,max;
cout<<"n=";
cin>>n;
for(i=1;i<=n;i++)
{cout<<"v["<<i<<"]=";
cin>>v[i];}
max=nrdiv(v[1]);
for(i=2;i<=n;i++)
if(max<nrdiv(v[i]))
max=nrdiv(v[i]);
for(i=1;i<=n;i++)
if(nrdiv(v[i])==max)
cout<<v[i]<<" ";
}

35.
create copii.dbf
1)list nume_copil for varsta>2
2)sort to copii2.dbf on prenume/a
use copii2.dbf
list
3)replace all nume_copil with 'cristi' for left(nume_copil,1)='a'
list
4)delete nume_copil for varsta>4
5)replace all varsta with varsta+1
list nume_copil for varsta>=7

BILET 36

#include<iostream.h>
#include<conio.h>
int suma(int m)
{int
s=0;
do
{s=s+m%10;
m=m/10;
}
while(m!=0);
return s;}
void main()
{int n;
clrscr();
cout<<"n=";cin>>n;
cout<<"numerele mai mici decat n divizibile cu suma cifrelor lor sunt:"<<endl;
for(int i=1;i<n;i++)
if(i%suma(i)==0)
cout<<i<<endl;

getch();
}

36.
create librarie.dbf
1)list nume_librarie for adresa='marului'
2)sort to librarie1.dbf on nume_librarie for vanzari>2000000
use librarie1.dbf
list
3)replace all stoc with stoc+50000
list
4)locate for titlu_carte='ion'
display

BILET 37

#include<iostream.h>
#include<conio.h>
//un nr este perfect daca este egal cu suma divizorilor sai proprii plus 1//
int perfect(int n)
{int i;
int s=1;
for(i=2;i<=n/2;i++)
if(n%i==0)
s=s+i;
return n==s;
}
void main()
{int n,j;
clrscr();
cout<<"n=";cin>>n;
cout<<"numarele perfecte mai mici sau egale cu n sunt:"<<endl;
for(j=1;j<=n;j++)
if(perfect(j))
cout<<j<<endl;
getch();
}

37.
create hoteluri.dbf
1.list all nume for left(nume,3)="pop"
2.list all nume hotel for oras="braila"
3.delete all for numar_locuri<50
4. list all nume_hotel for year(data_infiintarii)<1950

BILET 38

#include <iostream.h>

void main()

{int i,j,k,n;

{ cout<<"n="<<endl;
cin>>n;}

k=0;
for(i=1;i<=n;i++)
{ j=i;
while (j%5==0)

{k++;

j=j/5; }}
cout<<k;}

38.
create sportivi.dbf
1.count to x
?x
sort to sportiv.dbf on tara/a
use sportiv2.dbf
list tara
2.accept to y
list all sporturi,antrenor for tara=y
3.calculate max(proba1) to a
list all sportiv,antrenor for proba1=a
calculate max(proba2) to b
list all sportiv,antrenor for proba2=b
calculate max(proba3) to c
list all spotitv,antrenor for proba3=c

BILET 39

#include<fstream.h>
fstream f("distincte.out",ios::out);
long int m,i,j,v[1000];aparut[100];

void aparitie(long int k,int o)
{int ap=0,a=0;
for(j=1;j<=o;j++)
if(k==aparut[j])a=1;
if(a==0)
{for(j=1;j<=m;j++)
if(k==v[j]) ap++;

if(ap>1) {f<<"pentru numarul "<<k<<" avem "<<ap<<" aparitii";
f<<endl;}}}
void main()
{cout<<" cate numere are sirul ";
cin>>m;
cout<<endl;
cout<<"introdu nuemrele:";
cout<<endl;
for(i=1;i<=m;i++)
cin>>v[i];
int h=1;
aparut[1]=v[1];;
aparitie(v[1],0) ;
h++;
for(i=2;i<=m;i++)
{
aparut[h]=v[i];
aparitie(v[i],h-1);
h++;
}
}

39.
create bolnavi.dbf
1.list nume for data_i<date( )+14
2.accept "medic=" to x
copy fields nume,dagnostic to bolnavi2.dbf for medic=x
3.accept to x
count to y for medic=x
delete all for medic=x
list
4.sort to bolnavi3.dbf on nume
use bolnavi3.dbf
list

BILET 40

#include <fstream.h>

fstream f("numere.txt",ios::in);

struct nod
{
int nr;
nod* adr;
};

nod *p, *u;

void adaug_nod (int n)
{
nod *q;
if(!p)
{
p=new nod;
p->nr=n;
p->adr=0;
u=p;
}
else
{
q=new nod;
q->nr=n;
q->adr=0;
u->adr=q;
u=q;
}
}

int valid (int n)
{
nod *q;
for (q=p;q;q=q->adr)
if (q->nr==n)
return 0;
adaug_nod(n);
return 1;
}

int citire_date()
{
int n;
long int i=0;
nod *q;
while(f>>n)
if(n<100&valid(n))
i++;
return i;
}

void main()
{
cout<<citire_date();
}

40.
create stok.dbf
1.list all denumire for data_ultimei_miscari=date( )
2.list all denumire for cantitate<cant_normala
3.list all denumire for valoare>5000000
4.list all materiale for left(denumire,1)="f"