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

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