include iostream include stdlib include string include conio define LE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define LEN 100
using namespace std;
class massiv{
private:
int mas[LEN];
int n;
public:
massiv();
massiv(int, int[]);
void Output();
int func(int *);
};
int main(){
int kolvo = 0;
massiv massive;
int proizved = massive.func(&kolvo);
cout << kolvo << ", " << proizved;
}
massiv::massiv(){
cout <<"\nVvedite razmer massiva kol= ";
cin>>n;
for(int q=0;q<n;q++){
cout<<"Wvedite mas["<<(q+1)<<"]= ";
cin>>mas[q];
}
}
massiv::massiv(int m, int x[]){
n = m;
for (int q=0; q<n; q++)
mas[q] = x[q];
}
void massiv::Output(){
cout <<"\n\t Massive:"<<"\n\n";
for(int q=0;q<n;q++)
cout<<mas[q]<<" ";
cout << endl;
}
int massiv::func(int *kolvo){
int proizved = 1;
for (int q=0; q<n; q++)
if (mas[q] % 2 == 1){
proizved *= mas[q];
*kolvo = *kolvo + 1;
}
return proizved;
}