0% found this document useful (0 votes)
12 views3 pages

Barem

The document contains solutions to exam problems involving C++ programming concepts like arrays, functions, strings, files and passing variables by reference. Multiple problems are presented involving reading/writing to files, string manipulation, recursion and 2D arrays for modeling chess board positions.

Uploaded by

low1934
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Barem

The document contains solutions to exam problems involving C++ programming concepts like arrays, functions, strings, files and passing variables by reference. Multiple problems are presented involving reading/writing to files, string manipulation, recursion and 2D arrays for modeling chess board positions.

Uploaded by

low1934
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Barem

Subeictul I

1.b 2.a 3.d 4.a 5.c

Subiectul II
1. a.7 b.3

2. struct Mclasa{
int nr_elevi;
struct{
char nume[20],prenume[20];
struct{
char denumire[20].
int note[100];
int medie;
} materii[10];
int medieGenerala;
}elevi[100];
}

Mclasa C;
C.nr_elevi = 30;

for(int i = 0; i < C.nr_elevi; i++)


for(int j = 0; j < 10; j++)
if(C.elevi[i].materii[j].medie < 5)
cout << C.elevi[i].nume << “ “ << C.elevi[i].prenume << “ “ << C.elevi[i].materii[j];

for(int i = 0; i < C.nr_elevi; i++)


if(C.elevi[i].medieGenerala < 5)
cout << C.elevi[i].nume <<” “<<C.elevi[i].prenume<<”repetent”;
else{
int corigente = 0;
for(int j = 0; j < 10; j++)
if(C.elevi[i].materii[j].medie < 5)
corigente++;
if(corigente >= 3) cout << C.elevi[i].nume <<” “<<C.elevi[i].prenume<<”repetent”;
}
Barem

3. ..... <biblioteci>
int T[9][9] = {0}; // INDEXATA DE LA 1
int main(}{
int metode = 0;
int y = 4, x = 4; // pozitia regelui in matrice (D5)
for(int i = -1; i <=1;i+=2)
for(int j = -1; j <= 1; j+= 2)
T[ y + 2*i][x + j] = 1;

for(int i = -1; i <=1;i+=2)


for(int j = -1; j <= 1; j+= 2)
T[ y + i][x + 2*j] = 1;

for(x = 1; x <= 8; x++)


for(y = 1; y <= 8; y++)
metode += T[x][y];
cout << metode;
return “Sah mat”[0];
}

Subiectul III

1. void paranteze(int n, int &z){


z = 1;
for(int k = 2; k <=n; k++)
z *= (n + k) / k;
}

2. #include <biblioteci: iostream, cstring>....\ using namespace std;


int main(){
char s[101], b[51]; cin >> s;
for(int i = 0; i < strlen(s); i+=2){
char a = s[i];
int b = s[i+1] - ‘0’;
if(a >= ‘a’){
a += b;
while(a > ‘z’)
a -= (‘a’ - ‘A’);
}
else{
a += b;
while(a > ‘Z’) a-= (‘a’-’A’);
}
cout << a;
}return 0;}
Barem

3.#include <iostream>
#include <fstream>
using namespace std;
ifstream A("Mbac.in");
ofstream B("Mbac.out");

void nrcalc(int &x){


x = x * 2;
}

char incif(char &c,int &x){


c -= x;
if(c < 'a') c += 26;
return c;
}

int main(){
char c;
int x = 2;
while(A >> c){
nrcalc(x);
B << incif(c,x) << x<<" ";
}

return 0;
}

You might also like