• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Dec 16th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <iostream>
2. using namespace std;
3.
4. int main()
5. {
6.     int num, sum; // ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° ΠΈ ΡΡΠΌΠΌΠ°
7.     sum = 0;
8.     int max;
9.     max = 0;
10.     cout << "Enter integer value: ";
11.     cin >> num; // ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΎΡ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ ΡΠ°Π·ΠΌΠ΅ΡΠ° ΠΌΠ°ΡΡΠΈΠ²Π°
12.     if(num > 101){
13.         cout << "poshel hahooi!!!" << endl;
14.         return 1;
15.     }
16.     int *p_darr = new int[num]; // ΠΡΠ΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΏΠ°ΠΌΡΡΠΈ Π΄Π»Ρ ΠΌΠ°ΡΡΠΈΠ²Π°
17.
18.     for (int i = 0; i < num; i++) {
19.         // ΠΠ°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π° ΠΈ Π²ΡΠ²ΠΎΠ΄ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ Π΅Π³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ²
20.         cin >> p_darr[i];
21.         cout << "Value of " << i << " element is " << p_darr[i] << endl;
22.     }
23.     for (int i = 0; i < num; i++){
24.         if(p_darr[i] % 2 == 0){
25.             sum = sum + p_darr[i];
26.         }
27.     }
28.     cout << "sum even elements: " << sum << endl;
29.     //op2
30.     for (int i = 0; i < num; i++){
31.         if(p_darr[i] > p_darr[max]){//Π€ΠΠΠ‘ΠΠ Π’Π£Π’!!!
32.             max = i;
33.         }
34.     }
35.     cout<<"max "<<max<<endl;
36.     for(int i =  max +1; i < num; i++){
37.         p_darr[i] = p_darr[i+1];
38.     }
39.     for (int i = 0; i < num - 1; i++) {
40.         // ΠΠ°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π° ΠΈ Π²ΡΠ²ΠΎΠ΄ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ Π΅Π³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ²
41.         cout << "Value of " << i << " element is " << p_darr[i] << endl;
42.     }
43.     delete [] p_darr; // ΠΎΡΠΈΡΡΠΊΠ° ΠΏΠ°ΠΌΡΡΠΈ
44.     return 0;
45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?