- 1

Дан целочисленный массив. Вычислить сумму положительных элементов

Задача на C++. Дан целочисленный массив. Вычислить сумму положительных элементов. С вводом массива. Помогите с задачей

13th Dec 2018, 9:25 PM
Thomas Patient
Thomas Patient - avatar
7 odpowiedzi
+ 2
What have you done so far?
13th Dec 2018, 9:31 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 2
I would normally say: this is not a homework-providing service. Please make some effort and we will help you with the rest. But ok, here is an example int sum=0; int arr[10]={1,-2,-3,18,4,-5,7,11,-8,5}; for (int i=0;i<10;i++){ if( arr[i] > 0) sum+=arr[i]; } cout<<sum<<endl;
13th Dec 2018, 9:42 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 2
Lol, you are killing me. int arr[10]; for (int i = 0; i < 10; i++) { cin >> arr[i]; }
13th Dec 2018, 9:55 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 1
Thank you very much
13th Dec 2018, 10:06 PM
Thomas Patient
Thomas Patient - avatar
- 1
nothing
13th Dec 2018, 9:33 PM
Thomas Patient
Thomas Patient - avatar
- 1
thank you very much. one request how to implement input
13th Dec 2018, 9:49 PM
Thomas Patient
Thomas Patient - avatar
- 3
I am very sorry. How to connect these two codes?
13th Dec 2018, 10:36 PM
Thomas Patient
Thomas Patient - avatar