Sunteți pe pagina 1din 5

# Bac 2020 testul 2

Subiectul 1

Ex1. dx+20>=0&&x-20<=0

Ex2. c 1990

## Ex3. a- bentita,racheta,sapca //b. (fileu, grip, mingi, șapcă) -4p

Ex4 b-(2,0,1,1,2,1)

Subiectul 2

## Ex1. a.295 //20950 -6p

b. 60804,20406,80602

c. #include <iostream>

## using namespace std;

int main()

{ int n,m,c;

cin>>n;

m=0;

do

{c=n%10;

n=n/10;

if(c==0) c=2;

else if(c%2==0)c=0;

m=m*10+c;

cout<<m;

return 0;

repeta executa A

D. Citeste n

m<-0
c<-n%10

Altfel

m<-m*10+c

{ c<-n%10

{ Altfel

m<-m*10+c

Scrie m

## Ex2. struct specia

{int cod,nrExemplare;

Int varsta[9];

}s[19];

## using namespace std;

int main()

{ int i,j,a[5][7];

for(i=0;i<5;i++)

for(j=0;j<7;j++)

a[i][j]=1;

for(i=1;i<5;i++)

for(j=1;j<7;j++)

a[i][j]=(a[i][j-1]+a[i-1][j])%10;

## If(i==0 || j==0) a[i][j]=1;

Else a[i][j]=(a[i][j-1]+a[i-1][j])%10;

for(i=0;i<5;i++)

{for(j=0;j<7;j++)
cout<<a[i][j]<<" ";

cout<<endl; }

return 0;

Subiectu 3

Ex1.#include <iostream>

void fii(long n)

{int i ;

for(i=n;i>3;i--)

## if(n%i==0 && n/i!=i) {cout<<'('<<i<<" ";

cout<<n/i<<')'<<" ";}

int main()

{ int n;

cin>>n;

fii(n);

return 0;

## Ex2. #include <iostream> -6p

#include <cstring>

## using namespace std;

int main()

{int i,p=0,k,j;

char s[100],cuv[100],t[100];

gets(s);

i=0;
while(i<strlen(s))

k=-1;

## while(s[i]!=' '&& i<strlen(s)) {k++;

cuv[k]=s[i];

i++;}

cuv[++k]='\0';

//niciuna din aceste variante nu-mi merge,nu reusesc decat sa salvez primul cuvant, nu stiu

I. //for(j=0;j<=k;j++)

## //if (!(cuv[j]=='-'&&cuv[j+1]>=0&&cuv[j+1]<=9)) {t[p++]=cuv[j]; cout<<t<<" ";}

//else j++;

Ii.for(j=0;j<=k;j++)

## if(cuv[j]=='-'&& !(cuv[j+1]>='a'&&cuv[j+1]<='z')) { strcpy(cuv,cuv+1); j--;}

else t[p++]=cuv[j];

t[p]='\0';

strcpy(s,t);

cout<<s;

return 0;

int main()

{char s[256],cuv[25],s1[256];

int i,j,k=0;

gets(s);

strcat(s," ");

for(i=0;i<strlen(s);i++)

## if(s[i]!=' ') cuv[k++]=s[i];

else {cuv[k]='\0';

k=0;

}
strcpy(s,s1);

cout<<s;

## Ex3. #include <iostream>

#include <fstream>

## using namespace std;

ifstream fin("bac.in");

int main()

{int maxi1=INT_MIN,maxi2=INT_MIN,maxi3=INT_MIN;

long x;

while(fin>>x)

## if(x%10==0 && x/10%10==2)

if(x>maxi3) {maxi3=maxi2;

maxi2=maxi1;

maxi1=x;

enunt

maxi1=x;}

maxi1=x;

fin.close();

return 0;

## Meniu subsol

### Obține aplicațiile noastre gratuite

Drepturi de autor © 2021 Scribd Inc.