-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherunda
More file actions
46 lines (31 loc) · 1.43 KB
/
erunda
File metadata and controls
46 lines (31 loc) · 1.43 KB
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
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int i;//искомое число
int k;//кол-во элементов в последовательности
int posled[k];//массив последовательности (вводит пользователь)
int ck=0;//переменная для заполнения массива в цикле
int g;
int otv=0;
cout<<"Введите искомое число: ";
cin>>i;//пользователь ввел искомое число
cout<<"Введите кол-во элементов в последовательности: ";
cin>>k;//пользователь ввел кол-во элементов в последовательности
cout<<"Введите числа в последовательности: ";
for (ck=0;ck<k;ck++){
cin>>posled[ck];//пользователь ввел числа последовательности в массив
for(g=0;g<ck+1;g++){
if(posled[ck]==posled[g]){
otv++;
}
cout<<otv;
}
}
}