include iostream using namespace std class private int 100 int int pub

 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
#include <iostream>
using namespace std;
class Q{
private:
int a[100];
int n;
int k, l;
public:
void Enter(){
cout << "Vvedite dlinu massiva" << endl;
cin >> n;
cout << "Vvedite elementi massiva" << endl;
for (int q=0; q<n; q++)
cin >> a[q];
cout << "Vvedite chislo k" << endl;
cin >> k;
cout << "Vvedite chislo l" << endl;
cin >> l;
}
void Output(){
cout << endl;
for (int q=0; q<n; q++)
cout << a[q] << " ";
cout << endl;
}
int TaskOutPut(){
int sum = 0;
for (int q=k-1; q<=l-1; q++)
sum += a[q];
return sum;
}
};
int main(){
Q obj;
obj.Enter();
cout << obj.TaskOutPut() << endl;
}